From 4e89311f5c863d667ea69d4c074f7409f5563dab Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 17 Dec 2013 11:48:50 +0000 Subject: fix deadlock on pressing cancel in find files for gallery progress thread blocked on solarmutex press cancel in main thread which has solarmutex locked call terminate call join, which waits for thread to finish, which it can't because its waiting on the locked solarmutex so... just call terminate on cancel. Let the thread get the solarmutex and do its last round of work, at which point it will exit and post an event to the main thread to call Cleanup, put the join there instead and which point we know the progress thread is finished and has no more interest in the solarmutex. Change-Id: Ibe3976377288ac76b1b37c875a32e20b8d5daae1 --- cui/source/dialogs/cuigaldlg.cxx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx index be45aed67eea..a81dbd8201e6 100644 --- a/cui/source/dialogs/cuigaldlg.cxx +++ b/cui/source/dialogs/cuigaldlg.cxx @@ -221,10 +221,8 @@ SearchProgress::SearchProgress( Window* pParent, const INetURLObject& rStartURL void SearchProgress::Terminate() { - if (maSearchThread.is()) { + if (maSearchThread.is()) maSearchThread->terminate(); - maSearchThread->join(); - } } // ------------------------------------------------------------------------ @@ -239,7 +237,11 @@ IMPL_LINK_NOARG(SearchProgress, ClickCancelBtn) IMPL_LINK_NOARG(SearchProgress, CleanUpHdl) { + if (maSearchThread.is()) + maSearchThread->join(); + EndDialog( RET_OK ); + delete this; return 0L; } @@ -353,10 +355,8 @@ TakeProgress::TakeProgress( Window* pWindow ) : void TakeProgress::Terminate() { - if (maTakeThread.is()) { + if (maTakeThread.is()) maTakeThread->terminate(); - maTakeThread->join(); - } } // ------------------------------------------------------------------------ @@ -371,6 +371,9 @@ IMPL_LINK_NOARG(TakeProgress, ClickCancelBtn) IMPL_LINK_NOARG(TakeProgress, CleanUpHdl) { + if (maTakeThread.is()) + maTakeThread->join(); + TPGalleryThemeProperties* mpBrowser = (TPGalleryThemeProperties*) GetParent(); ::std::vector > aRemoveEntries( mpBrowser->aFoundList.size(), false ); ::std::vector< OUString > aRemainingVector; -- cgit