class wxProgressDialogTaskRunner : public wxThread
{
public:
- wxProgressDialogTaskRunner(wxWindow* parent)
- : wxThread(wxTHREAD_JOINABLE),
- m_parent(parent)
+ wxProgressDialogTaskRunner()
+ : wxThread(wxTHREAD_JOINABLE)
{ }
wxProgressDialogSharedData* GetSharedDataObject()
{ return &m_sharedData; }
private:
- wxWindow* m_parent;
wxProgressDialogSharedData m_sharedData;
virtual void* Entry();
}
#endif // wxHAS_MSW_TASKDIALOG
- return wxGenericProgressDialog::SetTitle(title);
+ wxGenericProgressDialog::SetTitle(title);
}
wxString wxProgressDialog::GetTitle() const
// We're showing the dialog for the first time, create the thread that
// will manage it.
- m_taskDialogRunner = new wxProgressDialogTaskRunner(GetParent());
+ m_taskDialogRunner = new wxProgressDialogTaskRunner;
m_sharedData = m_taskDialogRunner->GetSharedDataObject();
// Initialize shared data.
}
if ( !HasFlag(wxPD_APP_MODAL) )
- GetParent()->Disable();
+ {
+ wxWindow * const parent = GetTopParent();
+ if ( parent )
+ {
+ parent->Disable();
+ }
+ else
+ {
+ wxFAIL_MSG( "Progress dialog must have a valid parent if "
+ "wxPD_APP_MODAL is not used." );
+ }
+ }
//else: otherwise all windows will be disabled by m_taskDialogRunner
// Do not show the underlying dialog.