]> git.saurik.com Git - wxWidgets.git/blobdiff - src/propgrid/advprops.cpp
When wxPGProperty is un-attached from wxPropertyGrid, keep its 'default' cell referen...
[wxWidgets.git] / src / propgrid / advprops.cpp
index ba05073f6bfa0641b4a4873aa9a383a3c1a4fb3e..dafde5ff54cfe05390b2a3f9b26fb2cbdaf3e317 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     2004-09-25
 // RCS-ID:      $Id$
 // Copyright:   (c) Jaakko Salli
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // For compilers that support precompilation, includes "wx/wx.h".
@@ -240,12 +240,12 @@ WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(SpinCtrl,
                                       wxPGEditor)
 
 
-// Trivial destructor.
+// Destructor. It is useful to reset the global pointer in it.
 wxPGSpinCtrlEditor::~wxPGSpinCtrlEditor()
 {
+    wxPG_EDITOR(SpinCtrl) = NULL;
 }
 
-
 // Create controls and initialize event handling.
 wxPGWindowList wxPGSpinCtrlEditor::CreateControls( wxPropertyGrid* propgrid, wxPGProperty* property,
                                                    const wxPoint& pos, const wxSize& sz ) const
@@ -449,6 +449,7 @@ WX_PG_IMPLEMENT_INTERNAL_EDITOR_CLASS(DatePickerCtrl,
 
 wxPGDatePickerCtrlEditor::~wxPGDatePickerCtrlEditor()
 {
+    wxPG_EDITOR(DatePickerCtrl) = NULL;
 }
 
 wxPGWindowList wxPGDatePickerCtrlEditor::CreateControls( wxPropertyGrid* propgrid,
@@ -1821,16 +1822,8 @@ void wxImageFileProperty::OnSetValue()
     wxFileProperty::OnSetValue();
 
     // Delete old image
-    if ( m_pImage )
-    {
-        delete m_pImage;
-        m_pImage = NULL;
-    }
-    if ( m_pBitmap )
-    {
-        delete m_pBitmap;
-        m_pBitmap = NULL;
-    }
+    wxDELETE(m_pImage);
+    wxDELETE(m_pBitmap);
 
     wxFileName filename = GetFileName();
 
@@ -1859,8 +1852,7 @@ void wxImageFileProperty::OnCustomPaint( wxDC& dc,
         {
             m_pImage->Rescale( rect.width, rect.height );
             m_pBitmap = new wxBitmap( *m_pImage );
-            delete m_pImage;
-            m_pImage = NULL;
+            wxDELETE(m_pImage);
         }
 
         dc.DrawBitmap( *m_pBitmap, rect.x, rect.y, false );