Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.3.0 Beta1
-
None
-
Linux
Description
The documentation for deleteLater says:
If the event loop is not running when this function is called (e.g. deleteLater() is called on an object before QCoreApplication::exec()), the object will be deleted once the event loop is started.
This is true, but only if the QThreadData::loopLevel was equal to zero when deleteLater was called. If called from an event handler (e.g. a showEvent), loopLevel is 1, so the main event loop will refuse to process that DeferredDelete event (it only processes them for calls from higher nesting levels, such as any events handled by the main loop, or for events with loop level 0).
The attached testcase shows the issue.
You can see that the destructor of the job isn't called (and for that reason the window, which checks for alive jobs, cannot be closed).
A workaround is included (in a comment) : flushing DeferredDelete before entering app.exec(). This makes me think that this could be the fix, doing that within Qt?