Kaydet (Commit) 4e89311f authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst edbbc471
...@@ -221,10 +221,8 @@ SearchProgress::SearchProgress( Window* pParent, const INetURLObject& rStartURL ...@@ -221,10 +221,8 @@ SearchProgress::SearchProgress( Window* pParent, const INetURLObject& rStartURL
void SearchProgress::Terminate() void SearchProgress::Terminate()
{ {
if (maSearchThread.is()) { if (maSearchThread.is())
maSearchThread->terminate(); maSearchThread->terminate();
maSearchThread->join();
}
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
...@@ -239,7 +237,11 @@ IMPL_LINK_NOARG(SearchProgress, ClickCancelBtn) ...@@ -239,7 +237,11 @@ IMPL_LINK_NOARG(SearchProgress, ClickCancelBtn)
IMPL_LINK_NOARG(SearchProgress, CleanUpHdl) IMPL_LINK_NOARG(SearchProgress, CleanUpHdl)
{ {
if (maSearchThread.is())
maSearchThread->join();
EndDialog( RET_OK ); EndDialog( RET_OK );
delete this; delete this;
return 0L; return 0L;
} }
...@@ -353,10 +355,8 @@ TakeProgress::TakeProgress( Window* pWindow ) : ...@@ -353,10 +355,8 @@ TakeProgress::TakeProgress( Window* pWindow ) :
void TakeProgress::Terminate() void TakeProgress::Terminate()
{ {
if (maTakeThread.is()) { if (maTakeThread.is())
maTakeThread->terminate(); maTakeThread->terminate();
maTakeThread->join();
}
} }
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
...@@ -371,6 +371,9 @@ IMPL_LINK_NOARG(TakeProgress, ClickCancelBtn) ...@@ -371,6 +371,9 @@ IMPL_LINK_NOARG(TakeProgress, ClickCancelBtn)
IMPL_LINK_NOARG(TakeProgress, CleanUpHdl) IMPL_LINK_NOARG(TakeProgress, CleanUpHdl)
{ {
if (maTakeThread.is())
maTakeThread->join();
TPGalleryThemeProperties* mpBrowser = (TPGalleryThemeProperties*) GetParent(); TPGalleryThemeProperties* mpBrowser = (TPGalleryThemeProperties*) GetParent();
::std::vector<bool, std::allocator<bool> > aRemoveEntries( mpBrowser->aFoundList.size(), false ); ::std::vector<bool, std::allocator<bool> > aRemoveEntries( mpBrowser->aFoundList.size(), false );
::std::vector< OUString > aRemainingVector; ::std::vector< OUString > aRemainingVector;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment