From 71599f0a0ad3084f7c366d91db9384b56c82614a Mon Sep 17 00:00:00 2001 From: George Tasker Date: Mon, 14 Aug 2000 12:02:13 +0000 Subject: [PATCH] Code added to cleanup memory/resource leaks on exit git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/tex2rtf/src/tex2rtf.cpp | 83 ++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/utils/tex2rtf/src/tex2rtf.cpp b/utils/tex2rtf/src/tex2rtf.cpp index 88d23ff9c8..e5ac8969ce 100644 --- a/utils/tex2rtf/src/tex2rtf.cpp +++ b/utils/tex2rtf/src/tex2rtf.cpp @@ -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) -- 2.47.2