diff --git a/src/generic/filepickerg.cpp b/src/generic/filepickerg.cpp index 2b1c6d271d..aaeffe2e34 100644 --- a/src/generic/filepickerg.cpp +++ b/src/generic/filepickerg.cpp @@ -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 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