From: Mattia Barbon Date: Sat, 17 Jan 2004 22:14:38 +0000 (+0000) Subject: Handle client data correctly. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e94e2e952b3bde7f2d456e10a12589a80185407d Handle client data correctly. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25213 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index f295daac11..6e268ed40d 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -327,8 +327,7 @@ void wxComboBox::DoSetItemClientObject( int n, wxClientData* clientData ) wxList::compatibility_iterator node = m_clientObjectList.Item( n ); if (!node) return; - wxClientData *cd = (wxClientData*) node->GetData(); - if (cd) delete cd; + // wxItemContainer already deletes data for us node->SetData( (wxObject*) clientData ); } diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index f295daac11..6e268ed40d 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -327,8 +327,7 @@ void wxComboBox::DoSetItemClientObject( int n, wxClientData* clientData ) wxList::compatibility_iterator node = m_clientObjectList.Item( n ); if (!node) return; - wxClientData *cd = (wxClientData*) node->GetData(); - if (cd) delete cd; + // wxItemContainer already deletes data for us node->SetData( (wxObject*) clientData ); } diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index c3c5660bbf..5a911361cf 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -162,7 +162,10 @@ END_EVENT_TABLE() wxComboBox::~wxComboBox() { - // delete the controls now, don't leave them alive even though they would + // delete client objects + FreeData(); + + // delete the controls now, don't leave them alive even though they would // still be eventually deleted by our parent - but it will be too late, the // user code expects them to be gone now if (m_text != NULL) { diff --git a/src/mac/combobox.cpp b/src/mac/combobox.cpp index c3c5660bbf..5a911361cf 100644 --- a/src/mac/combobox.cpp +++ b/src/mac/combobox.cpp @@ -162,7 +162,10 @@ END_EVENT_TABLE() wxComboBox::~wxComboBox() { - // delete the controls now, don't leave them alive even though they would + // delete client objects + FreeData(); + + // delete the controls now, don't leave them alive even though they would // still be eventually deleted by our parent - but it will be too late, the // user code expects them to be gone now if (m_text != NULL) {