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:
parent
2d52841d08
commit
66806a0bf0
@ -59,11 +59,13 @@ class WXDLLEXPORT HtmlHistoryItem : public wxObject
|
||||
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(HtmlHistoryItem, HtmlHistoryArray);
|
||||
|
||||
|
||||
class wxHtmlWinModule;
|
||||
|
||||
class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxHtmlWindow)
|
||||
|
||||
friend class wxHtmlWinModule;
|
||||
|
||||
public:
|
||||
wxHtmlWindow() : wxScrolledWindow() {};
|
||||
@ -141,9 +143,6 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
||||
// called when users clicked on hypertext link. Default behavior is to
|
||||
// call LoadPage(loc)
|
||||
|
||||
static void CleanUpStatics();
|
||||
// cleans static variables
|
||||
|
||||
wxHtmlWinParser *GetParser() const { return m_Parser; }
|
||||
// return a pointer to the parser.
|
||||
|
||||
@ -166,6 +165,9 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
||||
virtual wxHtmlFilter *GetDefaultFilter() {return new wxHtmlFilterPlainText;}
|
||||
// returns new filter (will be stored into m_DefaultFilter variable)
|
||||
|
||||
static void CleanUpStatics();
|
||||
// cleans static variables
|
||||
|
||||
|
||||
protected:
|
||||
wxHtmlContainerCell *m_Cell;
|
||||
@ -204,13 +206,16 @@ class WXDLLEXPORT wxHtmlWindow : public wxScrolledWindow
|
||||
// contains last link name
|
||||
int m_tmpCanDrawLocks;
|
||||
// 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;
|
||||
// list of HTML filters
|
||||
static wxHtmlFilter *m_DefaultFilter;
|
||||
// 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;
|
||||
int m_HistoryPos;
|
||||
// browser history
|
||||
|
@ -30,6 +30,8 @@ class wxMimeTypesManagerImpl;
|
||||
#include "wx/string.h"
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
class wxMimeTypeCmnModule;
|
||||
|
||||
// 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
|
||||
// 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
|
||||
void EnsureImpl();
|
||||
|
||||
friend class wxMimeTypeCmnModule;
|
||||
};
|
||||
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
// for compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
#include "wx/module.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
@ -341,6 +342,29 @@ static wxMimeTypesManager 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
|
||||
// wxUSE_FILE && wxUSE_TEXTFILE
|
||||
|
||||
|
@ -419,6 +419,8 @@ void wxHtmlWindow::HistoryClear()
|
||||
|
||||
wxList wxHtmlWindow::m_Filters;
|
||||
wxHtmlFilter *wxHtmlWindow::m_DefaultFilter = NULL;
|
||||
wxCursor *wxHtmlWindow::s_cur_hand = NULL;
|
||||
wxCursor *wxHtmlWindow::s_cur_arrow = NULL;
|
||||
|
||||
void wxHtmlWindow::CleanUpStatics()
|
||||
{
|
||||
@ -426,7 +428,8 @@ void wxHtmlWindow::CleanUpStatics()
|
||||
m_DefaultFilter = NULL;
|
||||
m_Filters.DeleteContents(TRUE);
|
||||
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)
|
||||
{
|
||||
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)) {
|
||||
int sx, sy;
|
||||
@ -518,11 +525,11 @@ void wxHtmlWindow::OnIdle(wxIdleEvent& event)
|
||||
|
||||
if (lnk != m_tmpLastLink) {
|
||||
if (lnk == NULL) {
|
||||
SetCursor(cur_arrow);
|
||||
SetCursor(*s_cur_arrow);
|
||||
if (m_RelatedStatusBar != -1) m_RelatedFrame -> SetStatusText(wxEmptyString, m_RelatedStatusBar);
|
||||
}
|
||||
else {
|
||||
SetCursor(cur_hand);
|
||||
SetCursor(*s_cur_hand);
|
||||
if (m_RelatedStatusBar != -1)
|
||||
m_RelatedFrame -> SetStatusText(lnk -> GetHref(), m_RelatedStatusBar);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user