Qt Creator? Never heard of it 😊  I use Visual Studio, but I did already try 
this.

The assert kicks off directly from the command line as well.

Scott

From: Interest <interest-boun...@qt-project.org> On Behalf Of Axel Spoerl via 
Interest
Sent: Friday, March 3, 2023 9:43 AM
To: interest@qt-project.org
Subject: Re: [Interest] Weird assert, how to debug?

Hi Scot,
Please try running the executable from outside Qt Creator to eliminate its 
debugger as the troublemaker.
Cheers
Axel


On 3 Mar 2023, at 18:33, Scott Bloom 
<sc...@towel42.com<mailto:sc...@towel42.com>> wrote:
ï»ż
As you can see by the sample, Im not doing anything special, not changing any 
ownership, and not doing any individual deletes + deleteLaters with a 
processEvents (The root cause of many a “double delete in my experience”), so 
Im really stumped on this one.

Something in designer with the UI file is causing this.

Scott

From: Interest 
<interest-boun...@qt-project.org<mailto:interest-boun...@qt-project.org>> On 
Behalf Of Axel Spoerl via Interest
Sent: Thursday, March 2, 2023 10:09 PM
To: interest@qt-project.org<mailto:interest@qt-project.org>
Subject: Re: [Interest] Weird assert, how to debug?

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.

  1.  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.

  1.  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 
<interest-boun...@qt-project.org<mailto:interest-boun...@qt-project.org>> im 
Auftrag von Scott Bloom <sc...@towel42.com<mailto:sc...@towel42.com>>
Gesendet: Freitag, 3. MĂ€rz 2023 01:37
An: interest@qt-project.org<mailto:interest@qt-project.org> 
<interest@qt-project.org<mailto:interest@qt-project.org>>
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
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to