From 7d805b2d521f7e08a1f544997ca7a11ead72d82b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 26 Feb 2011 09:56:48 +0000 Subject: [PATCH] * Fixed unlocking the window before suspending the tracker task thread, which got broken/removed in r40226. * Also fixed a race condition that the previous code had, which is that after unlocking the window, the task thread could be interrupted, the window could theoretically go away and the view be destroyed before the thread continues, but we still access/dereference the BView pointer. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40698 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/tracker/StatusWindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kits/tracker/StatusWindow.cpp b/src/kits/tracker/StatusWindow.cpp index c93d62399d..673f3d0bf1 100644 --- a/src/kits/tracker/StatusWindow.cpp +++ b/src/kits/tracker/StatusWindow.cpp @@ -374,12 +374,14 @@ BStatusWindow::CheckCanceledOrPaused(thread_id thread) if (isPaused && view != NULL) { // say we are paused view->Invalidate(); + thread_id thread = view->Thread(); - ASSERT(find_thread(NULL) == view->Thread()); + lock.Unlock(); // and suspend ourselves // we will get resumed from BStatusView::MessageReceived - suspend_thread(view->Thread()); + ASSERT(find_thread(NULL) == thread); + suspend_thread(thread); } return wasCanceled;