]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/artgtk.cpp
Fix memory leak when a spacer is added, and crash when a window is added before wxSiz...
[wxWidgets.git] / src / gtk1 / artgtk.cpp
index 47aa4c93db6a2f7ed2641bc82938611b264b644b..a936c31900f5087e0edc592a74a18bf579fe681f 100644 (file)
@@ -136,7 +136,7 @@ GtkIconSize wxArtClientToIconSize(const wxArtClient& client)
     else if (client == wxART_BUTTON)
         return GTK_ICON_SIZE_BUTTON;
     else
     else if (client == wxART_BUTTON)
         return GTK_ICON_SIZE_BUTTON;
     else
-        return GTK_ICON_SIZE_BUTTON; // this is arbitrary
+        return GTK_ICON_SIZE_INVALID; // this is arbitrary
 }
 
 static GtkIconSize FindClosestIconSize(const wxSize& size)
 }
 
 static GtkIconSize FindClosestIconSize(const wxSize& size)
@@ -245,6 +245,10 @@ wxBitmap wxGTK2ArtProvider::CreateBitmap(const wxArtID& id,
                                 wxArtClientToIconSize(client) : 
                                 FindClosestIconSize(size);
 
                                 wxArtClientToIconSize(client) : 
                                 FindClosestIconSize(size);
 
+    // we must have some size, this is arbitrary
+    if (stocksize == GTK_ICON_SIZE_INVALID)
+        stocksize = GTK_ICON_SIZE_BUTTON;
+
     // allow passing GTK+ stock IDs to wxArtProvider:
     if (!stockid)
         stockid = id.ToAscii();
     // allow passing GTK+ stock IDs to wxArtProvider:
     if (!stockid)
         stockid = id.ToAscii();