[Libreoffice-commits] core.git: cui/source

Caolán McNamara caolanm at redhat.com
Tue Dec 17 03:53:36 PST 2013


 cui/source/dialogs/cuigaldlg.cxx |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 4e89311f5c863d667ea69d4c074f7409f5563dab
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Dec 17 11:48:50 2013 +0000

    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

diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index be45aed..a81dbd8 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;


More information about the Libreoffice-commits mailing list