OSDN Git Service

Fix crash when opening directories before completing folder compare
authorsdottaka <none@none>
Tue, 27 Aug 2013 13:35:04 +0000 (22:35 +0900)
committersdottaka <none@none>
Tue, 27 Aug 2013 13:35:04 +0000 (22:35 +0900)
--HG--
branch : stable

Src/DirDoc.cpp
Src/DirView.cpp

index 9e5fca7..4641d56 100644 (file)
@@ -180,6 +180,13 @@ void CDirDoc::Serialize(CArchive& ar)
  */
 void CDirDoc::InitCompare(const PathContext & paths, bool bRecursive, CTempPathContext *pTempPathContext)
 {
+       // Abort previous comparing
+       while (m_diffThread.GetThreadState() == CDiffThread::THREAD_COMPARING)
+       {
+               m_diffThread.Abort();
+               Sleep(50);
+       }
+
        m_pDirView->DeleteAllDisplayItems();
        // Anything that can go wrong here will yield an exception.
        // Default implementation of operator new() never returns NULL.
index 3c41dc4..43edf2b 100644 (file)
@@ -2902,7 +2902,8 @@ LRESULT CDirView::OnUpdateUIMessage(WPARAM wParam, LPARAM lParam)
        if (wParam == CDiffThread::EVENT_COMPARE_COMPLETED)
        {
                // Close and destroy the dialog after compare
-               GetParentFrame()->ShowControlBar(m_pCmpProgressBar.get(), FALSE, FALSE);
+               if (m_pCmpProgressBar)
+                       GetParentFrame()->ShowControlBar(m_pCmpProgressBar.get(), FALSE, FALSE);
                m_pCmpProgressBar.reset();
 
                pDoc->CompareReady();