]> git.saurik.com Git - wxWidgets.git/commitdiff
Avoid crash on startup when using single mode in docview sample.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 22 Jun 2011 22:57:59 +0000 (22:57 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 22 Jun 2011 22:57:59 +0000 (22:57 +0000)
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

samples/docview/view.cpp

index bfc5af2e91f7882a4baa5bb3725903baa2bce504..f4e4462f5a4ac097d26ef1e3ac67807ccb5adf2a 100644 (file)
@@ -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;
 }