]> git.saurik.com Git - wxWidgets.git/commitdiff
fix (one off, so not really important) memory leak which happened if an application...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 24 Mar 2008 02:38:56 +0000 (02:38 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 24 Mar 2008 02:38:56 +0000 (02:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/xrc/xmlres.cpp

index 466faa9870f12e8290595f976ec1111bad030441..dfd48835d2e96ca34d09abec2662c97639de591e 100644 (file)
@@ -1782,6 +1782,17 @@ static void AddStdXRCID_Records()
 
 // --------------- module and globals -----------------------------
 
+// normally we would do the cleanup from wxXmlResourceModule::OnExit() but it
+// can happen that some XRC records have been created because of the use of
+// XRCID() in event tables, which happens during static objects initialization,
+// but then the application initialization failed and so the wx modules were
+// neither initialized nor cleaned up -- this static object does the cleanup in
+// this case
+static struct wxXRCStaticCleanup
+{
+    ~wxXRCStaticCleanup() { CleanXRCID_Records(); }
+} s_staticCleanup;
+
 class wxXmlResourceModule: public wxModule
 {
 DECLARE_DYNAMIC_CLASS(wxXmlResourceModule)