Hi Scott,
I can't make the reproducer crash on Qt 5.15.9 or on the latest dev (6.6).
The assertion happens in QWidget's destructor, when it wants to exit from the
focus list.
I can imagine two cases, how this assertion kicks in.
* The code path in the if statement right after the assertion has been
reached before:
if (d->focus_next != this) {
d->focus_next->d_func()->focus_prev = d->focus_prev;
d->focus_prev->d_func()->focus_next = d->focus_next;
d->focus_next = d->focus_prev = nullptr;
}
=> An already deleted widget is deleted a second time.
* Focus chain has changed without events having been processed, so the
destroyed widget doesn't know about it.
Happens in the debugger (e.g. Qt Creator) sometimes, because debugging output
is a notirious focus thief.
Option 2 seems more likely to me, since the assertion doesn't shout in release
builds.
Updating to the latest Qt Creator version may help. If it doesn't please file a
bugreport in https://bugreports.qt.io,
upload the reproducer, specify the Qt and (Qt Creator if used for debugging)
versions used.
Cheers
Axel
________________________________
Von: Interest <[email protected]> im Auftrag von Scott Bloom
<[email protected]>
Gesendet: Freitag, 3. März 2023 01:37
An: [email protected] <[email protected]>
Betreff: [Interest] Weird assert, how to debug?
Im getting an assertion in qwidget.cpp
“d->focus_prev->d_func()->focus_next == this” in Qwidget.cpp line 1443 (Qt
5.15.10)
I realize the response is going to be, create a minimal example, I created a
repo on github with it, it’s a simple cmake based project. Any help figuring
this out would be appreciated.
The application has a QApplication and a QDialog derived dialog. The dialog
has a tabwidget and a dialogbutton box.
The assertion gets thrown when the dialog is destroyed.
https://github.com/towel42-com/TestFocusAssert
This happens on Windows, I don’t have a linux box setup right now to test on
linux.
Thanks
Scott
_______________________________________________
Interest mailing list
[email protected]
https://lists.qt-project.org/listinfo/interest