From 83b9fa3119a8cba9ba4a5286a8fe38a7f53c9a27 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 8 Nov 2017 21:02:38 +0100 Subject: [PATCH] Get rid of unnecessary wxCriticalSectionLocker use No real changes, just don't lock a critical section for a short time only to lock it again almost immediately after unlocking -- just combine both blocks for which it is locked into one, there is no reason to release it for TASKDIALOGCONFIG and wxMSWTaskDialogConfig initialization which are both trivial operations not involving any callbacks. --- src/msw/progdlg.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/msw/progdlg.cpp b/src/msw/progdlg.cpp index 15b24e40bf..a4a444c56f 100644 --- a/src/msw/progdlg.cpp +++ b/src/msw/progdlg.cpp @@ -1047,22 +1047,16 @@ void wxProgressDialog::UpdateExpandedInformation(int value) void* wxProgressDialogTaskRunner::Entry() { - // If we have a parent, we must use it to have correct Z-order and icon, - // but this can only be done if we attach this thread input to the thread - // that created the parent window, i.e. the main thread. - wxWindow* parent = NULL; - { - wxCriticalSectionLocker locker(m_sharedData.m_cs); - parent = m_sharedData.m_parent; - } - WinStruct tdc; wxMSWTaskDialogConfig wxTdc; { wxCriticalSectionLocker locker(m_sharedData.m_cs); - wxTdc.parent = parent; + // If we have a parent, we must use it to have correct Z-order and + // icon, even if this comes at the price of attaching this thread input + // to the thread that created the parent window, i.e. the main thread. + wxTdc.parent = m_sharedData.m_parent; wxTdc.caption = m_sharedData.m_title.wx_str(); wxTdc.message = m_sharedData.m_message.wx_str();