X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e6feb95a79834836e88143b15d9f424ebe79621..9b69526274b023fa1460b29a92bea8bf82e4703f:/src/common/imagxpm.cpp?ds=sidebyside diff --git a/src/common/imagxpm.cpp b/src/common/imagxpm.cpp index 7d3bced364..22584d6655 100644 --- a/src/common/imagxpm.cpp +++ b/src/common/imagxpm.cpp @@ -77,6 +77,7 @@ license is as follows: # include "wx/defs.h" #endif +#if wxUSE_XPM #include "wx/imagxpm.h" #include "wx/wfstream.h" @@ -128,7 +129,7 @@ bool wxXPMHandler::SaveFile(wxImage * image, // 2. write the header: char tmpbuf[200]; - // VS: 200b is safe upper bound for anything produced by sprintf bellow + // VS: 200b is safe upper bound for anything produced by sprintf below // (101 bytes the string, neither %i can expand into more than 10 chars) sprintf(tmpbuf, "/* XPM */\n" @@ -207,9 +208,17 @@ bool wxXPMHandler::SaveFile(wxImage * image, tmp = wxT("};\n"); stream.Write(tmp.mb_str(), 3); + // Clean up: delete[] symbols; delete[] symbols_data; + // FIXME: it will be better to use macros-based wxHashTable & DeleteContents(TRUE) + table.BeginFind(); + while ((node = table.Next()) != NULL) + { + delete (wxHNode *) node->GetData(); + } + return TRUE; } @@ -221,3 +230,4 @@ bool wxXPMHandler::DoCanRead(wxInputStream& stream) #endif // wxUSE_STREAMS +#endif // wxUSE_XPM