fixing memory leaks & mem tracing false alerts
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5811 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -59,12 +59,14 @@ class WXDLLEXPORT HtmlHistoryItem : public wxObject
|
|||||||
|
|
||||||
WX_DECLARE_EXPORTED_OBJARRAY(HtmlHistoryItem, HtmlHistoryArray);
|
WX_DECLARE_EXPORTED_OBJARRAY(HtmlHistoryItem, HtmlHistoryArray);
|
||||||
|
|
||||||
|
class wxHtmlWinModule;
|
||||||
|
|
||||||
class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxHtmlWindow)
|
DECLARE_DYNAMIC_CLASS(wxHtmlWindow)
|
||||||
|
|
||||||
|
friend class wxHtmlWinModule;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxHtmlWindow() : wxScrolledWindow() {};
|
wxHtmlWindow() : wxScrolledWindow() {};
|
||||||
wxHtmlWindow(wxWindow *parent, wxWindowID id = -1,
|
wxHtmlWindow(wxWindow *parent, wxWindowID id = -1,
|
||||||
@@ -141,9 +143,6 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
|||||||
// called when users clicked on hypertext link. Default behavior is to
|
// called when users clicked on hypertext link. Default behavior is to
|
||||||
// call LoadPage(loc)
|
// call LoadPage(loc)
|
||||||
|
|
||||||
static void CleanUpStatics();
|
|
||||||
// cleans static variables
|
|
||||||
|
|
||||||
wxHtmlWinParser *GetParser() const { return m_Parser; }
|
wxHtmlWinParser *GetParser() const { return m_Parser; }
|
||||||
// return a pointer to the parser.
|
// return a pointer to the parser.
|
||||||
|
|
||||||
@@ -166,6 +165,9 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
|||||||
virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;}
|
virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;}
|
||||||
// returns new filter (will be stored into m_DefaultFilter variable)
|
// returns new filter (will be stored into m_DefaultFilter variable)
|
||||||
|
|
||||||
|
static void CleanUpStatics();
|
||||||
|
// cleans static variables
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxHtmlContainerCell *m_Cell;
|
wxHtmlContainerCell *m_Cell;
|
||||||
@@ -204,13 +206,16 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
|||||||
// contains last link name
|
// contains last link name
|
||||||
int m_tmpCanDrawLocks;
|
int m_tmpCanDrawLocks;
|
||||||
// if >0 contents of the window is not redrawn
|
// if >0 contents of the window is not redrawn
|
||||||
// (in order to avoid ugly bliking)
|
// (in order to avoid ugly blinking)
|
||||||
|
|
||||||
static wxList m_Filters;
|
static wxList m_Filters;
|
||||||
// list of HTML filters
|
// list of HTML filters
|
||||||
static wxHtmlFilter *m_DefaultFilter;
|
static wxHtmlFilter *m_DefaultFilter;
|
||||||
// this filter is used when no filter is able to read some file
|
// this filter is used when no filter is able to read some file
|
||||||
|
|
||||||
|
static wxCursor *s_cur_hand;
|
||||||
|
static wxCursor *s_cur_arrow;
|
||||||
|
|
||||||
HtmlHistoryArray m_History;
|
HtmlHistoryArray m_History;
|
||||||
int m_HistoryPos;
|
int m_HistoryPos;
|
||||||
// browser history
|
// browser history
|
||||||
|
@@ -30,6 +30,8 @@ class wxMimeTypesManagerImpl;
|
|||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
#include "wx/dynarray.h"
|
#include "wx/dynarray.h"
|
||||||
|
|
||||||
|
class wxMimeTypeCmnModule;
|
||||||
|
|
||||||
// This class holds information about a given "file type". File type is the
|
// This class holds information about a given "file type". File type is the
|
||||||
// same as MIME type under Unix, but under Windows it corresponds more to an
|
// same as MIME type under Unix, but under Windows it corresponds more to an
|
||||||
// extension than to MIME type (in fact, several extensions may correspond to a
|
// extension than to MIME type (in fact, several extensions may correspond to a
|
||||||
@@ -228,6 +230,8 @@ private:
|
|||||||
|
|
||||||
// if m_impl is NULL, create one
|
// if m_impl is NULL, create one
|
||||||
void EnsureImpl();
|
void EnsureImpl();
|
||||||
|
|
||||||
|
friend class wxMimeTypeCmnModule;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
// for compilers that support precompilation, includes "wx.h".
|
// for compilers that support precompilation, includes "wx.h".
|
||||||
#include "wx/wxprec.h"
|
#include "wx/wxprec.h"
|
||||||
|
#include "wx/module.h"
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
@@ -341,6 +342,29 @@ static wxMimeTypesManager gs_mimeTypesManager;
|
|||||||
wxMimeTypesManager * wxTheMimeTypesManager = &gs_mimeTypesManager;
|
wxMimeTypesManager * wxTheMimeTypesManager = &gs_mimeTypesManager;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class wxMimeTypeCmnModule: public wxModule
|
||||||
|
{
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxMimeTypeCmnModule)
|
||||||
|
public:
|
||||||
|
wxMimeTypeCmnModule() : wxModule() {}
|
||||||
|
bool OnInit() { return TRUE; }
|
||||||
|
void OnExit()
|
||||||
|
{ // this avoids false memory leak allerts:
|
||||||
|
if (gs_mimeTypesManager.m_impl != NULL)
|
||||||
|
{
|
||||||
|
delete gs_mimeTypesManager.m_impl;
|
||||||
|
gs_mimeTypesManager.m_impl = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxMimeTypeCmnModule, wxModule)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// wxUSE_FILE && wxUSE_TEXTFILE
|
// wxUSE_FILE && wxUSE_TEXTFILE
|
||||||
|
|
||||||
|
@@ -419,6 +419,8 @@ void wxHtmlWindow::HistoryClear()
|
|||||||
|
|
||||||
wxList wxHtmlWindow::m_Filters;
|
wxList wxHtmlWindow::m_Filters;
|
||||||
wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL;
|
wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL;
|
||||||
|
wxCursor *wxHtmlWindow::s_cur_hand = NULL;
|
||||||
|
wxCursor *wxHtmlWindow::s_cur_arrow = NULL;
|
||||||
|
|
||||||
void wxHtmlWindow::CleanUpStatics()
|
void wxHtmlWindow::CleanUpStatics()
|
||||||
{
|
{
|
||||||
@@ -426,7 +428,8 @@ void wxHtmlWindow::CleanUpStatics()
|
|||||||
m_DefaultFilter = NULL;
|
m_DefaultFilter = NULL;
|
||||||
m_Filters.DeleteContents(TRUE);
|
m_Filters.DeleteContents(TRUE);
|
||||||
m_Filters.Clear();
|
m_Filters.Clear();
|
||||||
|
if (s_cur_hand) delete s_cur_hand;
|
||||||
|
if (s_cur_arrow) delete s_cur_arrow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -504,7 +507,11 @@ void wxHtmlWindow::OnMouseEvent(wxMouseEvent& event)
|
|||||||
|
|
||||||
void wxHtmlWindow::OnIdle(wxIdleEvent& event)
|
void wxHtmlWindow::OnIdle(wxIdleEvent& event)
|
||||||
{
|
{
|
||||||
static wxCursor cur_hand(wxCURSOR_HAND), cur_arrow(wxCURSOR_ARROW);
|
if (s_cur_hand == NULL)
|
||||||
|
{
|
||||||
|
s_cur_hand = new wxCursor(wxCURSOR_HAND);
|
||||||
|
s_cur_arrow = new wxCursor(wxCURSOR_ARROW);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_tmpMouseMoved && (m_Cell != NULL)) {
|
if (m_tmpMouseMoved && (m_Cell != NULL)) {
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
@@ -518,11 +525,11 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& event)
|
|||||||
|
|
||||||
if (lnk != m_tmpLastLink) {
|
if (lnk != m_tmpLastLink) {
|
||||||
if (lnk == NULL) {
|
if (lnk == NULL) {
|
||||||
SetCursor(cur_arrow);
|
SetCursor(*s_cur_arrow);
|
||||||
if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(wxEmptyString, m_RelatedStatusBar);
|
if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(wxEmptyString, m_RelatedStatusBar);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SetCursor(cur_hand);
|
SetCursor(*s_cur_hand);
|
||||||
if (m_RelatedStatusBar != -1)
|
if (m_RelatedStatusBar != -1)
|
||||||
m_RelatedFrame -> SetStatusText(lnk -> GetHref(), m_RelatedStatusBar);
|
m_RelatedFrame -> SetStatusText(lnk -> GetHref(), m_RelatedStatusBar);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user