Corruption of event queue in case of deleteDockWidget + restoreState
alexisperin opened this issue · 3 comments
Hello,
I came across a nasty bug using the library. What happened is I called deleteDockWidget
on a floating CDockWidget (which calls a deleteLater
in your implementation) and right after that I called restoreState
on the CDockManager to load an other configuration that also contains a floating CDockWidget. The restoreState
method is called before the deleteLater
but once the deleteLater
is executed my application crashes.
I guess what happens is restoreState
tries to re-use the CDockContainer of the floating widget I was trying to delete and that container is then deleted too once the deleteLater
is executed on the floating widget.
There is no doubt that this kind bug was unpredictable. But I would be very gratefull if you could take a look at was is possible to do to add some more security in the code and prevent such a crash.
Thanks,
Alexis
Will it help, if you call QApplication::processEvents()
right before you call restoreState()
?
Thank you for your answer. Calling processEvents()
doesn't solve my problem, it looks like DeferredDelete events are handled differently than others (https://doc.qt.io/qt-6/qcoreapplication.html#processEvents).
The fix I currently have is to queue the call to restoreState()
. This makes sure it is executed after the deleteLater
. I am just wondering if there is something you could do on your side to avoid such a workaround ?
At the moment you are the only one with this issue so please use your work around.