From: Vadim Zeitlin Date: Wed, 22 Jun 2011 22:57:59 +0000 (+0000) Subject: Avoid crash on startup when using single mode in docview sample. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c346d3d299d05dd539d06b88ca98ca0af6ef12bd?ds=sidebyside Avoid crash on startup when using single mode in docview sample. The view doesn't have any associated frame when using the special "single view" mode in the sample, so don't try to show it when creating a new view. This resulted in a crash when starting the sample with --single command line parameter. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/docview/view.cpp b/samples/docview/view.cpp index bfc5af2e91..f4e4462f5a 100644 --- a/samples/docview/view.cpp +++ b/samples/docview/view.cpp @@ -53,6 +53,7 @@ bool DrawingView::OnCreate(wxDocument *doc, long flags) wxFrame* frame = app.CreateChildFrame(this, true); wxASSERT(frame == GetFrame()); m_canvas = new MyCanvas(this); + frame->Show(); } else // single document mode { @@ -64,7 +65,6 @@ bool DrawingView::OnCreate(wxDocument *doc, long flags) doc->GetCommandProcessor()->SetEditMenu(app.GetMainWindowEditMenu()); doc->GetCommandProcessor()->Initialize(); } - GetFrame()->Show(); return true; }