Fix memory leaks in artprov sample
The list control used in the Resources Browser dialog had dynamically allocated wxStrings assigned as item data that were never freed. Closes #22070.
This commit is contained in:
parent
085d15015a
commit
754f75c1cd
@ -192,6 +192,14 @@ wxArtBrowserDialog::wxArtBrowserDialog(wxWindow *parent)
|
|||||||
SetArtClient(wxART_MESSAGE_BOX);
|
SetArtClient(wxART_MESSAGE_BOX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxArtBrowserDialog::~wxArtBrowserDialog()
|
||||||
|
{
|
||||||
|
const int itemCount = m_list->GetItemCount();
|
||||||
|
|
||||||
|
// item data are set by the ART_ICON macro
|
||||||
|
for ( int i = 0; i < itemCount; ++i )
|
||||||
|
delete reinterpret_cast<wxString*>(m_list->GetItemData(i));
|
||||||
|
}
|
||||||
|
|
||||||
wxSize wxArtBrowserDialog::GetSelectedBitmapSize() const
|
wxSize wxArtBrowserDialog::GetSelectedBitmapSize() const
|
||||||
{
|
{
|
||||||
|
@ -22,6 +22,7 @@ class wxArtBrowserDialog : public wxDialog
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxArtBrowserDialog(wxWindow *parent);
|
wxArtBrowserDialog(wxWindow *parent);
|
||||||
|
~wxArtBrowserDialog();
|
||||||
|
|
||||||
void SetArtClient(const wxArtClient& client);
|
void SetArtClient(const wxArtClient& client);
|
||||||
void SetArtBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size = wxDefaultSize);
|
void SetArtBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size = wxDefaultSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user