On Mon, Feb 25, 2013 at 2:51 PM, Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> wrote: > Am 24/02/2013 10:40, schrieb jscipione@xxxxxxxxx: > >> - fTrackingPID = spawn_thread(_TrackTask, "menu_tracking", >> B_DISPLAY_PRIORITY, >> - NULL); >> + fTrackingPID = spawn_thread(_TrackTask, "menu_tracking", >> + B_DISPLAY_PRIORITY, NULL); > This line seems to have been exactly 80 characters wide - are your editor > settings alright, or did you only change it for esthetical reasons? I typically use 79 characters for my own code just so it looks nice in diffs (makes room for the +/-) but I wouldn't correct others code if they use 80. (http://imagebin.org/248099 is what I see in my editor, column is at character 81 so 81 characters long, right?) >> + if (Window()->IsLocked()) { >> + // If window is locked by the menu_tracking thread >> kill it >> + // to prevent a deadlock. See ticket #8539. >> + thread_id menu_tracking = >> find_thread("menu_tracking"); >> + if (menu_tracking != B_NAME_NOT_FOUND) >> + kill_thread(menu_tracking); >> + } > > While this introduces a style violation (menu_tracking -> menuTracking, or > even better trackingThread), if you have to kill a thread (that doesn't even > belong you), you are doing something wrong. > > Please revert this, and find the actual cause of the issue -- a deadlock > does not happen because something takes long, it happens because there is a > locking problem. Agreed, it didn't even completely fix the bug as it just popped up in a different place. Thanks to the Debugger I can see what's going on, but, I don't know how to fix it yet. I will revert this tonight, but I'd really prefer a proper fix for this bug. There is a deadlock between the sMonThread thread and the menu_tracking thread. I may need AnEvilYak's help on this one...