Re: Dive download crash - Qt model issues

2017-06-24 Thread Thiago Macieira
On sábado, 24 de junho de 2017 11:05:25 PDT you wrote:
> The solution to that problem is "--developer-build".  That actually
> does exactly the right thing from a "build one single app against the
> special Qt tree that has a couple of experimental patches"
> perspective.

You can just do -prefix $PWD/qtbase if you're building from the top-level 
qt5.git.

You can also build only qtconnectivity on top of your existing libs and not 
install it. With LD_LIBRARY_PATH and QT_PLUGIN_PATH environment variables set, 
you should be able to run without installing too.

> Honestly, I'd probably prefer a non-debug developer mode, but the
> extra debug printouts it also seems to cause were actually super
> helpful for getting BLE going.

That should not have affected the debugging output... It seems to be a Fedora 
patch:
https://src.fedoraproject.org/cgit/rpms/qt5-qtbase.git/tree/qtlogging.ini

You can override it by setting QT_LOGGING_RULES=*.debug=true

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Dive download crash - Qt model issues

2017-06-24 Thread Linus Torvalds
On Sat, Jun 24, 2017 at 10:54 AM, Thiago Macieira  wrote:
>
> Qt has release mode, debug mode and the "-developer-mode" switch. Be careful
> not to confuse the latter two: developer mode is debug mode but enables a few
> extra things so Qt's own unit tests can run, like exporting some functions so
> they can be called from the tests. Another consequence is that it compiles
> with -Werror and compiles each header individually, so the build time
> increases and you're more likely to get build failures.
>
> Unless you're developing Qt itself like me, you don't want that option. Debug
> mode is fine for debugging into Qt itself and enables Q_ASSERT.

The problem is that I have to build my own Qt library for the
bluetooth debugging, but I do *not* want to install it over the system
binaries (or, in fact, install it at all).

The solution to that problem is "--developer-build".  That actually
does exactly the right thing from a "build one single app against the
special Qt tree that has a couple of experimental patches"
perspective.

However, that solution is somewhat annoying, exactly because of things
like "-Werror" (which trigger errors that are compiler version
dependent, and in particular triggers errors in things like QtWebKit
that most Qt people don't seem to test because they prefer the
currently broken alternatives).

Honestly, I'd probably prefer a non-debug developer mode, but the
extra debug printouts it also seems to cause were actually super
helpful for getting BLE going.

The extra Q_ASSERT's? Yeah, not so much.

  Linus
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Dive download crash - Qt model issues

2017-06-24 Thread Stefan Fuchs
Hi All,

Am 24.06.2017 um 19:24 schrieb Dirk Hohndel:
>
> This is one of the ASSERTs in Qt that are compiled out in production code,
> so I'm pretty sure those with my binaries or who are compiling from source
> using standard Qt libraries won't see it.
>
>> Now, it may be that (once more) this is because I run my self-compiled
>> Qt, and apparently it ends up adding more sanity checks and asserts
>> when built in developer mode. So maybe it's not so reproducible for
>> others as it is for me.
>>
>> The relevant gdb back-trace seems to be:
>>
>> DownloadFromDCWidget::on_downloadCancelRetryButton_clicked() ->
>>  DiveImportedModel::clearTable() ->
>>QAbstractItemModel::beginRemoveRows()
> That should be easy to fix. In clearTable() do as the first line
>
> if (lastIndex < firstIndex)
>   return;
>
> and you shouldn't see this crash anymore.
Just as a side note: Dirk and I already fixed s.th. very similar in this
part of the code some time ago:
https://github.com/Subsurface-divelog/subsurface/commit/02e768a61beda2730efff1e84f5e5b7341418acf
https://github.com/Subsurface-divelog/subsurface/issues/332

Best regards
Stefan

-- 

Stefan Fuchs
E-Mail: sfu...@gmx.de 

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Dive download crash - Qt model issues

2017-06-24 Thread Dirk Hohndel

> On Jun 24, 2017, at 10:54 AM, Thiago Macieira  wrote:
> 
> On sábado, 24 de junho de 2017 10:16:06 PDT Linus Torvalds wrote:
>> Now, it may be that (once more) this is because I run my self-compiled
>> Qt, and apparently it ends up adding more sanity checks and asserts
>> when built in developer mode.
> 
> Going off on a tangent here, but...
> 
> Qt has release mode, debug mode and the "-developer-mode" switch. Be careful 
> not to confuse the latter two: developer mode is debug mode but enables a few 
> extra things so Qt's own unit tests can run, like exporting some functions so 
> they can be called from the tests. Another consequence is that it compiles 
> with -Werror and compiles each header individually, so the build time 
> increases and you're more likely to get build failures.
> 
> Unless you're developing Qt itself like me, you don't want that option. Debug 
> mode is fine for debugging into Qt itself and enables Q_ASSERT.

Linus is working with Alex on fixing the broken BLE support in Qt. So in that
sense, I'm pretty sure he is "developing Qt itself".

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Dive download crash - Qt model issues

2017-06-24 Thread Thiago Macieira
On sábado, 24 de junho de 2017 10:16:06 PDT Linus Torvalds wrote:
> Now, it may be that (once more) this is because I run my self-compiled
> Qt, and apparently it ends up adding more sanity checks and asserts
> when built in developer mode.

Going off on a tangent here, but...

Qt has release mode, debug mode and the "-developer-mode" switch. Be careful 
not to confuse the latter two: developer mode is debug mode but enables a few 
extra things so Qt's own unit tests can run, like exporting some functions so 
they can be called from the tests. Another consequence is that it compiles 
with -Werror and compiles each header individually, so the build time 
increases and you're more likely to get build failures.

Unless you're developing Qt itself like me, you don't want that option. Debug 
mode is fine for debugging into Qt itself and enables Q_ASSERT.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: Dive download crash - Qt model issues

2017-06-24 Thread Dirk Hohndel

> On Jun 24, 2017, at 10:16 AM, Linus Torvalds  
> wrote:
> 
> So because I'm testing my BLE code (yes, I have working downloads on
> the Suunto EON Steel over BLE - no, it's not ready to be merged yet,
> and other dive computers won't automatically work), I've been doing
> odd things when downloading.
> 
> And I hit an issue that seems to be about the Qt models, not the
> low-level downloading code itself.
> 
> It seems reproducible to me (and happens even without the BLE code, I
> just checked), so maybe somebody else could take a look. Somebody who
> knows our Qt models (Tomaz?)
> 
> The way to cause the crash is:
> 
> - have all existing dives downloaded (but want to download again due
> to testing downloading)
> 
> - download dives, forgetting to check the "Force all dives" button
> 
> - "Arghh, nothing downloaded"
> 
> - Check the "Force all dives" button and then press "Retry download"
> 
> and when I do that, I get
> 
>  ASSERT: "last >= first" in file itemmodels/qabstractitemmodel.cpp, line 2743
>  Aborted (core dumped)

This is one of the ASSERTs in Qt that are compiled out in production code,
so I'm pretty sure those with my binaries or who are compiling from source
using standard Qt libraries won't see it.

> Now, it may be that (once more) this is because I run my self-compiled
> Qt, and apparently it ends up adding more sanity checks and asserts
> when built in developer mode. So maybe it's not so reproducible for
> others as it is for me.
> 
> The relevant gdb back-trace seems to be:
> 
> DownloadFromDCWidget::on_downloadCancelRetryButton_clicked() ->
>  DiveImportedModel::clearTable() ->
>QAbstractItemModel::beginRemoveRows()

That should be easy to fix. In clearTable() do as the first line

if (lastIndex < firstIndex)
return;

and you shouldn't see this crash anymore.

Tomaz, why are we setting lastIndex to -1 instead of 0 (which would seem
more reasonable to me and would avoid this assert)?

/D
___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface