Don't require calling DoNativeBeforeUpdate() with locked CS
Acquire the lock in wxProgressDialog::DoNativeBeforeUpdate() itself instead of relying on the caller to do it. This is just a refactoring in preparation for further changes.
This commit is contained in:
@@ -54,8 +54,9 @@ public:
|
|||||||
virtual WXWidget GetHandle() const wxOVERRIDE;
|
virtual WXWidget GetHandle() const wxOVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Performs common routines to Update() and Pulse(). Requires the
|
// Common part of Update() and Pulse().
|
||||||
// shared object to have been entered.
|
//
|
||||||
|
// Returns false if the user requested cancelling the dialog.
|
||||||
bool DoNativeBeforeUpdate(bool *skip);
|
bool DoNativeBeforeUpdate(bool *skip);
|
||||||
|
|
||||||
// Updates the various timing informations for both determinate
|
// Updates the various timing informations for both determinate
|
||||||
|
@@ -404,17 +404,19 @@ bool wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip)
|
|||||||
#ifdef wxHAS_MSW_TASKDIALOG
|
#ifdef wxHAS_MSW_TASKDIALOG
|
||||||
if ( HasNativeTaskDialog() )
|
if ( HasNativeTaskDialog() )
|
||||||
{
|
{
|
||||||
|
if ( !DoNativeBeforeUpdate(skip) )
|
||||||
|
{
|
||||||
|
// Dialog was cancelled.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
value /= m_factor;
|
||||||
|
|
||||||
|
wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") );
|
||||||
|
|
||||||
{
|
{
|
||||||
wxCriticalSectionLocker locker(m_sharedData->m_cs);
|
wxCriticalSectionLocker locker(m_sharedData->m_cs);
|
||||||
|
|
||||||
// Do nothing in canceled state.
|
|
||||||
if ( !DoNativeBeforeUpdate(skip) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
value /= m_factor;
|
|
||||||
|
|
||||||
wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") );
|
|
||||||
|
|
||||||
m_sharedData->m_value = value;
|
m_sharedData->m_value = value;
|
||||||
m_sharedData->m_notifications |= wxSPDD_VALUE_CHANGED;
|
m_sharedData->m_notifications |= wxSPDD_VALUE_CHANGED;
|
||||||
|
|
||||||
@@ -474,11 +476,13 @@ bool wxProgressDialog::Pulse(const wxString& newmsg, bool *skip)
|
|||||||
#ifdef wxHAS_MSW_TASKDIALOG
|
#ifdef wxHAS_MSW_TASKDIALOG
|
||||||
if ( HasNativeTaskDialog() )
|
if ( HasNativeTaskDialog() )
|
||||||
{
|
{
|
||||||
wxCriticalSectionLocker locker(m_sharedData->m_cs);
|
|
||||||
|
|
||||||
// Do nothing in canceled state.
|
|
||||||
if ( !DoNativeBeforeUpdate(skip) )
|
if ( !DoNativeBeforeUpdate(skip) )
|
||||||
|
{
|
||||||
|
// Dialog was cancelled.
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxCriticalSectionLocker locker(m_sharedData->m_cs);
|
||||||
|
|
||||||
if ( !m_sharedData->m_progressBarMarquee )
|
if ( !m_sharedData->m_progressBarMarquee )
|
||||||
{
|
{
|
||||||
@@ -509,6 +513,8 @@ bool wxProgressDialog::DoNativeBeforeUpdate(bool *skip)
|
|||||||
#ifdef wxHAS_MSW_TASKDIALOG
|
#ifdef wxHAS_MSW_TASKDIALOG
|
||||||
if ( HasNativeTaskDialog() )
|
if ( HasNativeTaskDialog() )
|
||||||
{
|
{
|
||||||
|
wxCriticalSectionLocker locker(m_sharedData->m_cs);
|
||||||
|
|
||||||
if ( m_sharedData->m_skipped )
|
if ( m_sharedData->m_skipped )
|
||||||
{
|
{
|
||||||
if ( skip && !*skip )
|
if ( skip && !*skip )
|
||||||
|
Reference in New Issue
Block a user