bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug awt/29355] New: awt qt-peer deadlock


From: realthunder at pmail dot ntu dot edu dot sg
Subject: [Bug awt/29355] New: awt qt-peer deadlock
Date: 5 Oct 2006 13:01:56 -0000

I am using jikes1.22 + classpath0.92 + qt-peer + Qt4-mingw + jamvm1.4.3 +
cygwin. After getting everything working, I tested awt.Demo. It is very
unstable. Sometimes crashes, somtimes freezes. I have identified at least one
deadlock scenario. 

Inside QtComponentPeer::moveEvent(), it calls Component::setLocation(), who
grabs component tree lock. This moveEvent() is the Qt event handler, and is
called by Qt's main GUI thread. According to qt-peer's design, awt will access
all Qt GUI related methods by posting event to the Qt main thread, and
immediatly waiting for responses, e.g. methods like getSizeNative. However,
getSizeNative is originated from Component in another thread, who also holds
the tree lock. Hence, the deadlock occurs. I summarize as follows:

awt thread: Component:getMinimumSize()->minimumSize()->minimumSizeImpl()
--User has moved some UI component--
Qt thread: QtComponentPeer::moveEvent()
awt thread: Component holds tree lock
awt thread: peer.minimumSize()->QtComponentPeer::getNativeSize() posts event to
Qt thread
awt thread: wait for Qt thread to finish the event and notify
Qt thread: Component::setLocation()
Qt thread: Component acquiring tree lock
deadlock...

My solution is to create a private event in QtComponentPeer::moveEvent(), and
post it to QtToolkit thread and then handle it by itself in
QtComponentPeer::handlEvent(), and then call the Component.setLocation there. I
have tested it. It works. To be more accurate, we may need to lock and check
the actual location with Qt before calling setLocation, because while the
private event is still queueing, some other thread may have changed the
location. 

The same problem and solution exist for QtComponentPeer::resizeEvent()


-- 
           Summary: awt qt-peer deadlock
           Product: classpath
           Version: 0.92
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: awt
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: realthunder at pmail dot ntu dot edu dot sg


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29355





reply via email to

[Prev in Thread] Current Thread [Next in Thread]