From 68a9527d5185cdd9d3fef3d9421415c50de8794d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 23 Mar 2007 13:24:55 +0000 Subject: [PATCH] destroy m_impl even if an exception is thrown from the main loop git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45030 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/evtloop.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gtk/evtloop.cpp b/src/gtk/evtloop.cpp index 2b2bfa91c4..16fa2087f2 100644 --- a/src/gtk/evtloop.cpp +++ b/src/gtk/evtloop.cpp @@ -25,6 +25,7 @@ #endif #include "wx/evtloop.h" +#include "wx/ptr_scpd.h" #ifndef WX_PRECOMP #include "wx/app.h" @@ -55,6 +56,8 @@ private: // wxEventLoop implementation // ============================================================================ +wxDEFINE_TIED_SCOPED_PTR_TYPE(wxEventLoopImpl) + // ---------------------------------------------------------------------------- // wxEventLoop running and exiting // ---------------------------------------------------------------------------- @@ -71,17 +74,13 @@ int wxEventLoop::Run() wxEventLoopActivator activate(this); - m_impl = new wxEventLoopImpl; + wxEventLoopImplTiedPtr impl(&m_impl, new wxEventLoopImpl); gtk_main(); OnExit(); - int exitcode = m_impl->GetExitCode(); - delete m_impl; - m_impl = NULL; - - return exitcode; + return m_impl->GetExitCode(); } void wxEventLoop::Exit(int rc) -- 2.47.2