]> git.saurik.com Git - wxWidgets.git/commitdiff
No changes, just use wxScopedPtr instead of explicit "delete".
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 18 Dec 2011 12:27:04 +0000 (12:27 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 18 Dec 2011 12:27:04 +0000 (12:27 +0000)
Use wxScopedPtr in wxGenericFileDirButton to ensure that the dialog created by
it is always destroyed, even if an exception is thrown while showing the
dialog or while processing the event we generate after showing it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/filepickerg.cpp

index 2b1c6d271d2e86bfb4d36354cc8934459ddc3b8b..aaeffe2e34e14488afc48d2035d7188d385cac3f 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "wx/filepicker.h"
 
+#include "wx/scopedptr.h"
+
 
 // ============================================================================
 // implementation
@@ -92,18 +94,16 @@ bool wxGenericFileDirButton::Create(wxWindow *parent,
 
 void wxGenericFileDirButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev))
 {
-    wxDialog *p = CreateDialog();
+    wxScopedPtr<wxDialog> p(CreateDialog());
     if (p->ShowModal() == wxID_OK)
     {
         // save updated path in m_path
-        UpdatePathFromDialog(p);
+        UpdatePathFromDialog(p.get());
 
         // fire an event
         wxFileDirPickerEvent event(GetEventType(), this, GetId(), m_path);
         GetEventHandler()->ProcessEvent(event);
     }
-
-    wxDELETE(p);
 }
 
 #endif      // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL