if (!(col->Ok())) {
delete col;
- return NULL;
+ return (wxColour *) NULL;
}
Append( colour, col );
return col;
wxBitmapList::~wxBitmapList ()
{
- wxLogDebug("~wxBitmapList: count = %d", Number());
+#ifdef __WXMSW__
wxNode *node = First ();
while (node)
{
wxBitmap *bitmap = (wxBitmap *) node->Data ();
wxNode *next = node->Next ();
- delete bitmap;
-// bitmap->FreeResource(TRUE);
+ if (bitmap->GetVisible())
+ delete bitmap;
node = next;
}
+#endif
}
// Pen and Brush lists
wxPenList::~wxPenList ()
{
+#ifdef __WXMSW__
wxNode *node = First ();
while (node)
{
wxPen *pen = (wxPen *) node->Data ();
wxNode *next = node->Next ();
- delete pen;
-// pen->FreeResource(TRUE);
+ if (pen->GetVisible())
+ delete pen;
node = next;
}
+#endif
}
void wxPenList::AddPen (wxPen * pen)
if (the_colour)
return FindOrCreatePen (*the_colour, width, style);
else
- return NULL;
+ return (wxPen *) NULL;
}
wxBrushList::~wxBrushList ()
{
+#ifdef __WXMSW__
wxNode *node = First ();
while (node)
{
wxBrush *brush = (wxBrush *) node->Data ();
wxNode *next = node->Next ();
- delete brush;
+ if (brush->GetVisible())
+ delete brush;
node = next;
}
+#endif
}
void wxBrushList::AddBrush (wxBrush * brush)
if (the_colour)
return FindOrCreateBrush (*the_colour, style);
else
- return NULL;
+ return (wxBrush *) NULL;
}
void wxBrushList::RemoveBrush (wxBrush * brush)
wxFontList::~wxFontList ()
{
-#ifdef __WXMSW__
wxNode *node = First ();
while (node)
{
-/*
- wxFont *font = (wxFont *) node->Data ();
- wxNode *next = node->Next ();
- delete font;
- node = next;
-*/
- // New for 2.0: don't delete the font (it may be a member
- // of a wxDC, for example)
+ // Only delete objects that are 'visible', i.e.
+ // that have been created using FindOrCreate...,
+ // where the pointers are expected to be shared
+ // (and therefore not deleted by any one part of an app).
wxFont *font = (wxFont *) node->Data ();
wxNode *next = node->Next ();
-
- // Force the font to be deleted
- font->FreeResource(TRUE);
+ if (font->GetVisible())
+ delete font;
node = next;
- }
-#endif
+}
}
void wxFontList::AddFont (wxFont * font)