From: <hug...@li...> - 2011-01-30 10:22:55
|
branch: details: http://hugin.hg.sourceforge.net/hgweb/hugin/hugin/hgrepo/h/hu/hugin/hugin/rev/c12c2275eb60 changeset: 4912:c12c2275eb60 user: tmodes date: Sun Jan 30 11:22:21 2011 +0100 description: Fixes crash with closed overview window, Windows only [700896] diffstat: src/hugin1/hugin/GLPreviewFrame.cpp | 22 +++++++++++++++++----- src/hugin1/hugin/GLPreviewFrame.h | 4 +++- src/hugin1/hugin/GLViewer.cpp | 2 ++ src/hugin1/hugin/MainFrame.cpp | 11 +++++++++++ 4 files changed, 33 insertions(+), 6 deletions(-) diffs (120 lines): diff -r 1c1ed5d4e858 -r c12c2275eb60 src/hugin1/hugin/GLPreviewFrame.cpp --- a/src/hugin1/hugin/GLPreviewFrame.cpp Sun Jan 30 02:10:06 2011 -0500 +++ b/src/hugin1/hugin/GLPreviewFrame.cpp Sun Jan 30 11:22:21 2011 +0100 @@ -623,9 +623,6 @@ this->SetBackgroundColour(m_GLPreview->GetBackgroundColour()); #endif - if (config->Read(wxT("/GLPreviewFrame/isShown"), 0l) != 0) { - Show(); - } m_showProjectionHints = config->Read(wxT("/GLPreviewFrame/ShowProjectionHints"), HUGIN_SHOW_PROJECTION_HINTS) == 1; wxAcceleratorEntry entries[3]; entries[0].Set(wxACCEL_NORMAL,WXK_F11,ID_FULL_SCREEN); @@ -640,17 +637,23 @@ // tell the manager to "commit" all the changes just made m_mgr->Update(); + + if (config->Read(wxT("/GLPreviewFrame/isShown"), 0l) != 0) + { +#ifdef __WXMSW__ + InitPreviews(); +#endif + Show(); + } } void GLPreviewFrame::LoadOpenGLLayout() { - PauseResize(); wxString OpenGLLayout=wxConfig::Get()->Read(wxT("/GLPreviewFrame/OpenGLLayout")); if(!OpenGLLayout.IsEmpty()) { m_mgr->LoadPerspective(OpenGLLayout,true); }; - ContinueResize(); }; GLPreviewFrame::~GLPreviewFrame() @@ -714,6 +717,15 @@ DEBUG_TRACE("dtor end"); } +void GLPreviewFrame::InitPreviews() +{ + if(!preview_helper || !panosphere_overview_helper || !plane_overview_helper) + { + m_GLPreview->SetUpContext(); + m_GLOverview->SetUpContext(); + LoadOpenGLLayout(); + }; +}; bool GLwxAuiManager::ProcessDockResult(wxAuiPaneInfo& target, const wxAuiPaneInfo& new_pos) diff -r 1c1ed5d4e858 -r c12c2275eb60 src/hugin1/hugin/GLPreviewFrame.h --- a/src/hugin1/hugin/GLPreviewFrame.h Sun Jan 30 02:10:06 2011 -0500 +++ b/src/hugin1/hugin/GLPreviewFrame.h Sun Jan 30 11:22:21 2011 +0100 @@ -190,6 +190,8 @@ void FillBlendChoice(); /** loads the layout of the OpenGL windows and restores it */ void LoadOpenGLLayout(); + /** init previews */ + void InitPreviews(); GLwxAuiManager* getAuiManager() {return m_mgr;} GLPreview* getPreview() {return m_GLPreview;} @@ -208,13 +210,13 @@ void redrawPreview(); /** set status if projection hints should be shown or not*/ void SetShowProjectionHints(bool new_value); + void OnShowEvent(wxShowEvent& e); protected: bool GLresize; void OnClose(wxCloseEvent& e); - void OnShowEvent(wxShowEvent& e); void OnOverviewToggle(wxCommandEvent& e); diff -r 1c1ed5d4e858 -r c12c2275eb60 src/hugin1/hugin/GLViewer.cpp --- a/src/hugin1/hugin/GLViewer.cpp Sun Jan 30 02:10:06 2011 -0500 +++ b/src/hugin1/hugin/GLViewer.cpp Sun Jan 30 11:22:21 2011 +0100 @@ -189,7 +189,9 @@ // we can fill it just now, because we need a OpenGL context, which was created now, // to check if all necessary extentions are available frame->FillBlendChoice(); +#ifndef __WXMSW__ frame->LoadOpenGLLayout(); +#endif } void GLOverview::setUp() diff -r 1c1ed5d4e858 -r c12c2275eb60 src/hugin1/hugin/MainFrame.cpp --- a/src/hugin1/hugin/MainFrame.cpp Sun Jan 30 02:10:06 2011 -0500 +++ b/src/hugin1/hugin/MainFrame.cpp Sun Jan 30 11:22:21 2011 +0100 @@ -1349,10 +1349,21 @@ void MainFrame::OnToggleGLPreviewFrame(wxCommandEvent & e) { +#ifdef __WXMSW__ + gl_preview_frame->InitPreviews(); +#endif if (gl_preview_frame->IsIconized()) { gl_preview_frame->Iconize(false); } gl_preview_frame->Show(); +#ifdef __WXMSW__ + // on wxMSW Show() does not send OnShowEvent needed to update the + // visibility state of the fast preview windows + // so explicit calling this event handler + wxShowEvent se; + se.SetShow(true); + gl_preview_frame->OnShowEvent(se); +#endif gl_preview_frame->Raise(); } |