]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/ctrlsub.cpp
Avoid crash when releasing the mouse in wxRibbonToolBar.
[wxWidgets.git] / src / common / ctrlsub.cpp
index d668d66503c16a798a889935292d547853e9ed69..68d4b1a5916150f05b753abca0a2c6d77307e0f2 100644 (file)
@@ -123,7 +123,7 @@ void wxItemContainer::Delete(unsigned int pos)
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
-// 
+//
 // ----------------------------------------------------------------------------
 
 int wxItemContainer::DoInsertItemsInLoop(const wxArrayStringsAdapter& items,
 // ----------------------------------------------------------------------------
 
 int wxItemContainer::DoInsertItemsInLoop(const wxArrayStringsAdapter& items,
@@ -191,6 +191,18 @@ wxClientData *wxItemContainer::GetClientObject(unsigned int n) const
     return static_cast<wxClientData *>(DoGetItemClientData(n));
 }
 
     return static_cast<wxClientData *>(DoGetItemClientData(n));
 }
 
+wxClientData *wxItemContainer::DetachClientObject(unsigned int n)
+{
+    wxClientData * const data = GetClientObject(n);
+    if ( data )
+    {
+        // reset the pointer as we don't own it any more
+        DoSetItemClientData(n, NULL);
+    }
+
+    return data;
+}
+
 void wxItemContainer::SetClientData(unsigned int n, void *data)
 {
     if ( !HasClientData() )
 void wxItemContainer::SetClientData(unsigned int n, void *data)
 {
     if ( !HasClientData() )