Prevent a deadlock condition in Deskbar. Fixes #8539

If the window is locked by the menu_tracking thread Deskbar will wait
on the sMonThread thread to exit forever so we have to kill it to
prevent a deadlock.

This is a workaround of a bigger problem, which is that fExpando gets
created and destroyed on each change which is slow allowing these kinds
of bugs to exist. The real solution is to live update fExpando but that
is a fair amount of work.
This commit is contained in:
John Scipione
2013-02-24 04:39:16 -05:00
parent 88571c9241
commit 733be65954
+8
View File
@@ -195,6 +195,14 @@ TExpandoMenuBar::DetachedFromWindow()
if (sMonThread != B_ERROR) {
sDoMonitor = false;
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);
}
status_t returnCode;
wait_for_thread(sMonThread, &returnCode);