]> git.saurik.com Git - wxWidgets.git/commitdiff
Code added to cleanup memory/resource leaks on exit
authorGeorge Tasker <gtasker@allenbrook.com>
Mon, 14 Aug 2000 12:02:13 +0000 (12:02 +0000)
committerGeorge Tasker <gtasker@allenbrook.com>
Mon, 14 Aug 2000 12:02:13 +0000 (12:02 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

utils/tex2rtf/src/tex2rtf.cpp

index 88d23ff9c82845cbc5c0cb457b8b5e0f8b47f8c6..e5ac8969cee815f094443f20cde637dc6fbcb711 100644 (file)
@@ -60,6 +60,13 @@ int passNumber = 1;
 
 #ifndef NO_GUI
 
+extern char *BigBuffer;
+extern char *TexFileRoot;
+extern char *TexBibName;         // Bibliography output file name
+extern char *TexTmpBibName;      // Temporary bibliography output file name
+extern wxList ColourTable;
+extern TexChunk *TopLevel;
+
 #if wxUSE_HELP
 wxHelpController *HelpInstance = NULL;
 #endif // wxUSE_HELP
@@ -134,6 +141,8 @@ bool MyApp::OnInit()
   WinHelpContentsFileName = new char[300];
   RefName = new char[300];
 
+  ColourTable.DeleteContents(TRUE);
+
   int n = 1;
 
   // Read input/output files
@@ -427,6 +436,77 @@ int MyApp::OnExit()
   delete HelpInstance;
 #endif // wxUSE_HELP
 
+    if (BigBuffer)
+    {
+      delete BigBuffer;
+      BigBuffer = NULL;
+    }
+    if (currentArgData)
+    {
+      delete currentArgData;
+      currentArgData = NULL;
+    }
+    if (TexFileRoot)
+    {
+      delete TexFileRoot;
+      TexFileRoot = NULL;
+    }
+    if (TexBibName)
+    {
+      delete TexBibName;
+      TexBibName = NULL;
+    }
+    if (TexTmpBibName)
+    {
+      delete TexTmpBibName;
+      TexTmpBibName = NULL;
+    }
+    if (FileRoot)
+    {
+      delete FileRoot;
+      FileRoot = NULL;
+    }
+    if (ContentsName)
+    {
+      delete ContentsName;
+      ContentsName = NULL;
+    }
+    if (TmpContentsName)
+    {
+      delete TmpContentsName;
+      TmpContentsName = NULL;
+    }
+    if (TmpFrameContentsName)
+    {
+      delete TmpFrameContentsName;
+      TmpFrameContentsName = NULL;
+    }
+    if (WinHelpContentsFileName)
+    {
+      delete WinHelpContentsFileName;
+      WinHelpContentsFileName = NULL;
+    }
+    if (RefName)
+    {
+      delete RefName;
+      RefName = NULL;
+    }
+    if (TopLevel)
+    {
+      delete TopLevel;
+      TopLevel = NULL;
+    }
+    if (MacroFile)
+    {
+      delete MacroFile;
+      MacroFile = NULL;
+    }
+    if (RTFCharset)
+    {
+      delete RTFCharset;
+      RTFCharset = NULL;
+    }
+
   // TODO: this simulates zero-memory leaks!
   // Otherwise there are just too many...
 #ifndef __WXGTK__
@@ -497,7 +577,8 @@ void MyFrame::OnCloseWindow(wxCloseEvent& event)
 
 void MyFrame::OnExit(wxCommandEvent& event)
 {
-    this->Destroy();
+  Close();
+//    this->Destroy();
 }
 
 void MyFrame::OnGo(wxCommandEvent& event)