projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added simplified chinese translations
[wxWidgets.git]
/
samples
/
memcheck
/
memcheck.cpp
diff --git
a/samples/memcheck/memcheck.cpp
b/samples/memcheck/memcheck.cpp
index 65d1cbf2359982cf8b710febccc843a71052dc26..3d4fe1f16b188a7c1a4155bee9034f394c35e461 100644
(file)
--- a/
samples/memcheck/memcheck.cpp
+++ b/
samples/memcheck/memcheck.cpp
@@
-5,8
+5,8
@@
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
// Modified by:
// Created: 04/01/98
// RCS-ID: $Id$
-// Copyright: (c) Julian Smart
and Markus Holzem
-// Licence: wxWindows license
+// Copyright: (c) Julian Smart
+// Licence:
wxWindows license
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
@@
-25,9
+25,9
@@
#include "wx/wx.h"
#endif
#include "wx/wx.h"
#endif
-#include "wx/date.h"
+#include "wx/date
time
.h"
-#if
def __WXGTK__
+#if
defined(__WXGTK__) || defined(__WXX11__) || defined(__WXMOTIF__) || defined(__WXMAC__)
#include "mondrian.xpm"
#endif
#include "mondrian.xpm"
#endif
@@
-35,6
+35,12
@@
#error This program must be compiled in debug mode.
#endif
#error This program must be compiled in debug mode.
#endif
+// Normally, new is automatically defined to be the
+// debugging version. If not, this does it.
+#if !defined(new) && defined(WXDEBUG_NEW)
+#define new WXDEBUG_NEW
+#endif
+
// Define a new application type
class MyApp: public wxApp
{ public:
// Define a new application type
class MyApp: public wxApp
{ public:
@@
-59,11
+65,7
@@
bool MyApp::OnInit(void)
MyFrame *frame = new MyFrame((wxFrame *) NULL);
// Give it an icon
MyFrame *frame = new MyFrame((wxFrame *) NULL);
// Give it an icon
-#ifdef __WXMSW__
- frame->SetIcon(wxIcon("mondrian"));
-#else
- frame->SetIcon(wxIcon(mondrian_xpm));
-#endif
+ frame->SetIcon(wxICON(mondrian));
// Make a menubar
wxMenu *file_menu = new wxMenu;
// Make a menubar
wxMenu *file_menu = new wxMenu;
@@
-82,20
+84,29
@@
bool MyApp::OnInit(void)
frame->Show(TRUE);
wxDebugContext::SetCheckpoint();
frame->Show(TRUE);
wxDebugContext::SetCheckpoint();
-// wxDebugContext::SetFile("debug.log");
wxString *thing = new wxString;
wxString *thing = new wxString;
- wxDate* date = new wxDate;
+
+#if wxUSE_DATETIME
+ wxDateTime* date = new wxDateTime;
+#endif // wxUSE_DATETIME
// non-object allocation
char *ordinaryNonObject = new char[1000];
const char *data = (const char*) thing ;
// non-object allocation
char *ordinaryNonObject = new char[1000];
const char *data = (const char*) thing ;
+ // On MSW, Dump() crashes if using wxLogGui,
+ // so use wxLogStderr instead.
+ wxLog* oldLog = wxLog::SetActiveTarget(new wxLogStderr);
+
wxDebugContext::PrintClasses();
wxDebugContext::Dump();
wxDebugContext::PrintStatistics();
wxDebugContext::PrintClasses();
wxDebugContext::Dump();
wxDebugContext::PrintStatistics();
+ // Set back to wxLogGui
+ delete wxLog::SetActiveTarget(oldLog);
+
// Don't delete these objects, to force wxApp to flag a memory leak.
// delete thing;
// delete date;
// Don't delete these objects, to force wxApp to flag a memory leak.
// delete thing;
// delete date;