From e6b01b78a3a55d341cac1cc7a3b48e7bd2380beb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 3 Dec 2001 00:30:51 +0000 Subject: [PATCH] fixed mem leak in wxDataObjectComposite git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12835 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/dataobj.h | 2 +- src/common/dobjcmn.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/wx/dataobj.h b/include/wx/dataobj.h index 7c7aee91f9..923f297094 100644 --- a/include/wx/dataobj.h +++ b/include/wx/dataobj.h @@ -254,7 +254,7 @@ class WXDLLEXPORT wxDataObjectComposite : public wxDataObject { public: // ctor - wxDataObjectComposite() { m_preferred = 0; } + wxDataObjectComposite(); // add data object (it will be deleted by wxDataObjectComposite, hence it // must be allocated on the heap) whose format will become the preferred diff --git a/src/common/dobjcmn.cpp b/src/common/dobjcmn.cpp index d2d6a4e5b7..661b8114dc 100644 --- a/src/common/dobjcmn.cpp +++ b/src/common/dobjcmn.cpp @@ -94,6 +94,13 @@ bool wxDataObjectBase::IsSupported(const wxDataFormat& format, // wxDataObjectComposite // ---------------------------------------------------------------------------- +wxDataObjectComposite::wxDataObjectComposite() +{ + m_preferred = 0; + + m_dataObjects.DeleteContents(TRUE); +} + wxDataObjectSimple * wxDataObjectComposite::GetObject(const wxDataFormat& format) const {