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

Tim Jansen ml at tjansen.de
Tue Jul 30 19:21:27 BST 2002


On Tuesday 30 July 2002 10:58, Matthias Kretz wrote:
> I got crashes in a KListView (should probably crash with QListView, too)
> when dragging and dropping ListViewItems around. I just had to do it long
> enough - normally around 20 times - and it would crash with the attached

BTW There is a similar problem: when using QThread::postEvent(), Qt can crash 
as well. If your computer is busy (e.g. compiling) and you delete the 
receiving object after posting the event, Qt will segfault because it 
attempts to post the event to the already deleted object. This is because Qt 
does not prevent the event thread from deleting the object before the event 
is in the object's event queue - it tries to force the kernel to reschedule 
to the event thread by writing to a (dummy) pipe, but this only succeeds when 
the system is idle. 
Waiting for postEvent() to finish is not enough, nor waiting for the posting 
thread. You really need to track the number of events that have not been 
delivered to the object and call processEvents() until the object got all 
events, then you can delete it. krdc uses a helper class to prevent this 
problem by counting events. I hope to have a good test case in a few days...

bye...





More information about the kde-core-devel mailing list