Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: mike__t on October 31, 2007, 05:54:48 pm

Title: wxSmith crash on opening a resource with patch
Post by: mike__t on October 31, 2007, 05:54:48 pm
Seen on SVN version 4582 on Ubuntu Gutsy, wxGTK-2.8.6

Not sure why this problem wasn't visible before, but it was crashing when setting about the color property editor for the property sheet editor--it seemed to be wandering of the end of the array of wxsColourLabels looking for a NULL while enumerating them.

This patch fixed this crash for me:
Code
--- wxwidgets/properties/wxscolourproperty.cpp  (revision 4582)
+++ wxwidgets/properties/wxscolourproperty.cpp  (working copy)
@@ -90,10 +90,11 @@
         _("Gradient of active caption"),
         _("Gradnent of inactive caption"),
         _("Selected menu item"),
-        _("Menu bar")
+        _("Menu bar"),
+        NULL
     };

-    static const int wxsColourCount = sizeof(wxsColourLabels) / sizeof(wxsColourLabels[0]);
+    static const int wxsColourCount = sizeof(wxsColourLabels) / sizeof(wxsColourLabels[0]) - 1;

     static long wxsColourValues[] = {
         wxsCOLOUR_DEFAULT,
Title: Re: wxSmith crash on opening a resource with patch
Post by: byo on October 31, 2007, 08:22:48 pm
Thanks for the info. I have never had such crash but that was probably only a big good luck ;)


BYO