OSDN Git Service

Fix redraw all when loading thread finish load log
authorFrank Li <lznuaa@gmail.com>
Wed, 28 Jan 2009 15:15:10 +0000 (23:15 +0800)
committerFrank Li <lznuaa@gmail.com>
Wed, 28 Jan 2009 15:15:10 +0000 (23:15 +0800)
src/TortoiseProc/GitLogListBase.cpp
src/TortoiseProc/LogDlg.cpp

index f02f247..da63694 100644 (file)
@@ -116,6 +116,13 @@ CGitLogListBase::~CGitLogListBase()
                delete m_pStoreSelection;\r
                m_pStoreSelection = NULL;\r
        }\r
                delete m_pStoreSelection;\r
                m_pStoreSelection = NULL;\r
        }\r
+\r
+       if(this->m_bThreadRunning)\r
+       {\r
+               m_bExitThread=true;\r
+               WaitForSingleObject(m_LoadingThread->m_hThread,1000);\r
+               TerminateThread();\r
+       }\r
 }\r
 \r
 \r
 }\r
 \r
 \r
@@ -1483,7 +1490,8 @@ UINT CGitLogListBase::LogThread()
 \r
        FillGitShortLog();\r
        \r
 \r
        FillGitShortLog();\r
        \r
-       \r
+       if(this->m_bExitThread)\r
+               return 0;\r
 \r
        RedrawItems(0, m_arShownList.GetCount());\r
        SetRedraw(false);\r
 \r
        RedrawItems(0, m_arShownList.GetCount());\r
        SetRedraw(false);\r
@@ -1537,6 +1545,9 @@ UINT CGitLogListBase::LogThread()
                                this->InvalidateRect(rect);\r
                        }\r
                        \r
                                this->InvalidateRect(rect);\r
                        }\r
                        \r
+                       if(m_bExitThread)\r
+                               return 0;\r
+\r
                        percent=updated*98/m_logEntries.size() + GITLOG_START+1;\r
                        if(percent == GITLOG_END)\r
                                percent = GITLOG_END -1;\r
                        percent=updated*98/m_logEntries.size() + GITLOG_START+1;\r
                        if(percent == GITLOG_END)\r
                                percent = GITLOG_END -1;\r
@@ -1544,8 +1555,7 @@ UINT CGitLogListBase::LogThread()
                        if(m_ProcCallBack)\r
                                m_ProcCallBack(m_ProcData,percent);\r
 \r
                        if(m_ProcCallBack)\r
                                m_ProcCallBack(m_ProcData,percent);\r
 \r
-                       if(m_bExitThread)\r
-                               break;\r
+                       \r
                }\r
                if(updated==m_logEntries.size())\r
                        break;\r
                }\r
                if(updated==m_logEntries.size())\r
                        break;\r
@@ -1810,6 +1820,7 @@ void CGitLogListBase::StartFilter()
        //ResizeAllListCtrlCols();\r
        SetRedraw(true);\r
        Invalidate();\r
        //ResizeAllListCtrlCols();\r
        SetRedraw(true);\r
        Invalidate();\r
+\r
 }\r
 void CGitLogListBase::RemoveFilter()\r
 {\r
 }\r
 void CGitLogListBase::RemoveFilter()\r
 {\r
index 5f8ef99..c78a09f 100644 (file)
@@ -396,7 +396,7 @@ void CLogDlg::LogRunStatus(int cur)
                DialogEnableWindow(IDC_STATBUTTON, TRUE);\r
                DialogEnableWindow(IDC_REFRESH, TRUE);\r
 \r
                DialogEnableWindow(IDC_STATBUTTON, TRUE);\r
                DialogEnableWindow(IDC_REFRESH, TRUE);\r
 \r
-               PostMessage(WM_TIMER, LOGFILTER_TIMER);\r
+//             PostMessage(WM_TIMER, LOGFILTER_TIMER);\r
 \r
                //CTime time=m_LogList.GetOldestTime();\r
                CTime begin,end;\r
 \r
                //CTime time=m_LogList.GetOldestTime();\r
                CTime begin,end;\r
@@ -752,7 +752,14 @@ void CLogDlg::OnCancel()
        {\r
                //m_bCancelled = true;\r
                //return;\r
        {\r
                //m_bCancelled = true;\r
                //return;\r
-               m_LogList.TerminateThread();\r
+               if(m_LogList.m_bThreadRunning)\r
+               {\r
+                       //m_LogList.m_bExitThread=true;\r
+                       //WaitForSingleObject(m_LogList.m_LoadingThread->m_hThread,INFINITE);\r
+                       m_LogList.TerminateThread();\r
+               }\r
+\r
+               //m_LogList.TerminateThread();\r
        }\r
        UpdateData();\r
        if (m_bSaveStrict)\r
        }\r
        UpdateData();\r
        if (m_bSaveStrict)\r