qapplication_x11.cpp: Change in event-loop behaviour causes crashes.

Waldo Bastian bastian at kde.org
Fri Jul 26 01:03:38 BST 2002


A recent change (Qt 3.0.5?) in the event loop handling makes that events are 
being processed in the popup-event loop after the popup has been closed. This 
causes numerous crashes.

Example: if you have a widget which shows a popupmenu on mousepress and the 
popupmenu has an action such as "Delete" attached to one of the menu-items  
you often have to delay the action a bit to prevent that you delete the 
widget that was clicked on before it returns from the mouse-press event 
handler. If you don't your applications will crash in the mouse press event 
handler.

Two common ways to do this are QObject::deleteLater() and 
QTimer::singleShot().

However, with the recent changes to the event loop both these events are now 
handled from the event-loop of the popupmenu instead of returning to the main 
event loop first. This results in the crashes that these methods were 
supposed to prevent.

The attached patch fixes the problem.

Cheers,
Waldo
-- 
bastian at kde.org  |   SuSE Labs KDE Developer  |  bastian at suse.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qapplication_x11.patch
Type: text/x-diff
Size: 937 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020725/c5d0a27d/attachment.patch>


More information about the kde-core-devel mailing list