Cured memory leak report in wxDateTime; wxGLCanvas corrections

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5739 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2000-01-30 13:43:37 +00:00
parent 4c45f240f6
commit f6081a0462
11 changed files with 68 additions and 11 deletions

View File

@ -144,7 +144,7 @@ wx: $(CFG) $(DUMMY).obj $(OBJECTS) $(PERIPH_TARGET) $(LIBTARGET)
$(LIBTARGET): $(DUMMY).obj $(OBJECTS) $(PERIPH_LIBS)
erase $(LIBTARGET)
tlib $(LIBTARGET) /P1024 @&&!
tlib $(LIBTARGET) /P2048 @&&!
+$(COMMONOBJS:.obj =.obj +)\
+$(GENERICOBJS:.obj =.obj +)\
+$(MSWOBJS:.obj =.obj +)\

View File

@ -240,6 +240,34 @@ generated. At least it will divide the number of files in samples
directory by 10 (and the number of files to be maintained too).
</blockquote>
<P>
<H3>How do you use VC++'s memory leak checking instead of that in wxWindows?</H3>
Vadim Zeitlin:
<pre>
On the VC++ level, it's just the matter of calling _CrtSetDbgFlag() in the very
beginning of the program. In wxWindows, this is done automatically when
compiling with VC++ in debug mode unless wxUSE_GLOBAL_MEMORY_OPERATORS or
__NO_VC_CRTDBG__ are defined - this check is done in wx/msw/msvcrt.h which
is included from app.cpp which then calls wxCrtSetDbgFlag() without any
#ifdefs.
This works quite well: at the end of the program, all leaked blocks with their
malloc count are shown. This number (malloc count) can be used to determine
where exactly the object was allocated: for this it's enough to set the variable
_crtBreakAlloc (look in VC98\crt\srs\dbgheap.c line 326) to this number and
a breakpoint will be triggered when the block with this number is allocated.
For simple situations it works like a charm. For something more complicated
like reading uninitialized memory a specialized tool is probably better...
Regards,
VZ
</pre>
</font>
</BODY>

View File

@ -49,7 +49,7 @@ PNM format, {\bf wxPNMHandler} will always save as raw RGB.
\wxheading{See also}
\helpref{wxBitmap}{wxbitmap}
\helpref{wxBitmap}{wxbitmap},
\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
\latexignore{\rtfignore{\wxheading{Members}}}

View File

@ -1259,8 +1259,10 @@ WX_DECLARE_OBJARRAY(wxDateTime, wxDateTimeArray);
class WXDLLEXPORT wxDateTimeHolidayAuthority;
WX_DEFINE_EXPORTED_ARRAY(wxDateTimeHolidayAuthority *, wxHolidayAuthoritiesArray);
class wxDateTimeHolidaysModule;
class WXDLLEXPORT wxDateTimeHolidayAuthority
{
friend wxDateTimeHolidaysModule;
public:
// returns TRUE if the given date is a holiday
static bool IsHoliday(const wxDateTime& dt);

View File

@ -122,6 +122,7 @@ public:
virtual void OnExit()
{
wxDateTimeHolidayAuthority::ClearAllAuthorities();
wxDateTimeHolidayAuthority::ms_authorities.Clear();
}
private:

View File

@ -230,7 +230,7 @@ static wxString MakeCorrectPath(const wxString& path)
cnt = p.Length();
for (i = 0; i < cnt; i++)
if (p.GetChar(i) == wxT('\\')); p.GetWritableChar(i) = wxT('/'); // wanna be windows-safe
if (p.GetChar(i) == wxT('\\')) p.GetWritableChar(i) = wxT('/'); // Want to be windows-safe
if (p.Left(2) == wxT("./")) { p = p.Mid(2); cnt -= 2; }
@ -382,7 +382,7 @@ wxString wxFileSystem::FindFirst(const wxString& spec, int flags)
m_FindFileHandler = NULL;
for (int i = spec2.Length()-1; i >= 0; i--)
if (spec2[(unsigned int) i] == wxT('\\')) spec2.GetWritableChar(i) = wxT('/'); // wanna be windows-safe
if (spec2[(unsigned int) i] == wxT('\\')) spec2.GetWritableChar(i) = wxT('/'); // Want to be windows-safe
node = m_Handlers.GetFirst();
while (node)

View File

@ -415,6 +415,11 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
// wxPrinterDC bit blitting/bitmap drawing
// ----------------------------------------------------------------------------
// Win16 doesn't define GDI_ERROR.
#ifndef GDI_ERROR
#define GDI_ERROR -1
#endif
void wxPrinterDC::DoDrawBitmap(const wxBitmap &bmp,
wxCoord x, wxCoord y,
bool useMask)

View File

@ -28,6 +28,11 @@
#pragma hdrstop
#endif
// For _A_SUBDIR, etc.
#if defined(__BORLANDC__) && defined(__WIN16__)
#include <dos.h>
#endif
#ifndef WX_PRECOMP
#include "wx/intl.h"
#include "wx/log.h"

View File

@ -273,7 +273,7 @@ wx: $(CFG) $(DUMMY).obj $(OBJECTS) $(PERIPH_TARGET) $(LIBTARGET)
$(LIBTARGET): $(DUMMY).obj $(OBJECTS) $(PERIPH_LIBS)
erase $(LIBTARGET)
tlib $(LIBTARGET) /P1024 @&&!
tlib $(LIBTARGET) /P2048 @&&!
+$(COMMONOBJS:.obj =.obj +)\
+$(GENERICOBJS:.obj =.obj +)\
+$(MSWOBJS:.obj =.obj +)\

View File

@ -2283,12 +2283,16 @@ bool wxWindow::MSWCreate(int id,
if ( width > -1 ) width1 = width;
if ( height > -1 ) height1 = height;
// Unfortunately this won't work in WIN16. Unless perhaps
// we define WS_EX_CONTROLPARENT ourselves?
#ifndef __WIN16__
// if we have wxTAB_TRAVERSAL style, we want WS_EX_CONTROLPARENT or
// IsDialogMessage() won't work for us
if ( GetWindowStyleFlag() & wxTAB_TRAVERSAL )
{
extendedStyle |= WS_EX_CONTROLPARENT;
}
#endif
HWND hParent = (HWND)NULL;
if ( parent )

View File

@ -129,14 +129,25 @@ END_EVENT_TABLE()
wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList /* not used yet! */, const wxPalette& palette):
wxScrolledWindow(parent, id, pos, size, style, name)
wxScrolledWindow()
{
m_hDC = (WXHDC) ::GetDC((HWND) GetHWND());
m_glContext = (wxGLContext*) NULL;
SetupPixelFormat();
SetupPalette(palette);
bool ret = Create(parent, id, pos, size, style, name);
if ( ret )
{
SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT));
}
m_hDC = (WXHDC) ::GetDC((HWND) GetHWND());
SetupPixelFormat();
SetupPalette(palette);
m_glContext = new wxGLContext(TRUE, this, palette);
m_glContext = new wxGLContext(TRUE, this, palette);
}
wxGLCanvas::wxGLCanvas( wxWindow *parent,
@ -144,8 +155,9 @@ wxGLCanvas::wxGLCanvas( wxWindow *parent,
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
int *attribList, const wxPalette& palette )
: wxScrolledWindow()
// : wxScrolledWindow(parent, id, pos, size, style, name)
{
m_glContext = (wxGLContext*) NULL;
bool ret = Create(parent, id, pos, size, style, name);
if ( ret )