From d41b919e5e2ff00935d8962c61915ca92a09d5ac Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Wed, 1 Feb 2012 11:10:51 +0100 Subject: [PATCH] ProgressDlg: prevent possible race condition with git.exe return code (mainly x86) RunCmdList returned the return code of the git commands, but the messages MSG_PROGRESSDLG_END and MSG_PROGRESSDLG_FAILED are sent before that, so OnProgressUpdateUI might got an uninitialized value of m_GitStatus. Included the return code into the message to prevent this. Signed-off-by: Sven Strickroth --- src/TortoiseProc/ProgressDlg.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/TortoiseProc/ProgressDlg.cpp b/src/TortoiseProc/ProgressDlg.cpp index ee2eaae97..104a7252f 100644 --- a/src/TortoiseProc/ProgressDlg.cpp +++ b/src/TortoiseProc/ProgressDlg.cpp @@ -223,7 +223,7 @@ UINT CProgressDlg::RunCmdList(CWnd *pWnd,std::vector &cmdlist,bool bSho CloseHandle(hRead); - pWnd->PostMessage(MSG_PROGRESSDLG_UPDATE_UI,MSG_PROGRESSDLG_FAILED,0); + pWnd->PostMessage(MSG_PROGRESSDLG_UPDATE_UI, MSG_PROGRESSDLG_FAILED, status); return TGIT_GIT_ERROR_GET_EXIT_CODE; } ret |= status; @@ -233,7 +233,7 @@ UINT CProgressDlg::RunCmdList(CWnd *pWnd,std::vector &cmdlist,bool bSho CloseHandle(hRead); - pWnd->PostMessage(MSG_PROGRESSDLG_UPDATE_UI,MSG_PROGRESSDLG_END,0); + pWnd->PostMessage(MSG_PROGRESSDLG_UPDATE_UI, MSG_PROGRESSDLG_END, ret); return ret; @@ -291,6 +291,8 @@ LRESULT CProgressDlg::OnProgressUpdateUI(WPARAM wParam,LPARAM lParam) m_Progress.SetPos(100); this->DialogEnableWindow(IDOK,TRUE); + m_GitStatus = lParam; + CString err; err.Format(_T("\r\n\r\ngit did not exit cleanly (exit code %d)\r\n"), m_GitStatus); if(this->m_GitStatus) -- 2.11.4.GIT