summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2013-12-17 11:48:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-12-17 11:53:16 +0000
commit4e89311f5c863d667ea69d4c074f7409f5563dab (patch)
tree9ba1aba0cad4bbb7bb539d0bcafe1f47d45734bc
parentedbbc471bcd9db9b366c32e9d16d965460cd3960 (diff)
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
-rw-r--r--cui/source/dialogs/cuigaldlg.cxx15
1 files 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<bool, std::allocator<bool> > aRemoveEntries( mpBrowser->aFoundList.size(), false );
::std::vector< OUString > aRemainingVector;