User forums > Help

C::B crashing on start (Ubuntu 13.04 & Mint 15)

<< < (4/5) > >>

Jenna:
It might also be a wxWidgets bug.

oBFusCATed:
Ubuntu and windows users please try this patch to see if the crashes are fixed and the code still works on windows:


--- Code: ---Index: src/src/debuggermenu.cpp
===================================================================
--- src/src/debuggermenu.cpp    (revision 9174)
+++ src/src/debuggermenu.cpp    (working copy)
@@ -78,11 +78,25 @@ namespace
             return nullptr;
         if (recreate)
         {
-            wxMenu *subMenu = item->GetSubMenu();
-            while (subMenu->GetMenuItemCount() > 0)
+            wxMenu *menu = item->GetMenu();
+            size_t pos = static_cast<size_t>(wxNOT_FOUND);
+            for (size_t ii = 0; ii < menu->GetMenuItemCount(); ++ii)
             {
-                wxMenuItemList& list=subMenu->GetMenuItems();
-                subMenu->Remove(list.GetFirst()->GetData());
+                if (item == menu->FindItemByPosition(ii))
+                {
+                    pos = ii;
+                    break;
+                }
+            }
+            if (pos != static_cast<size_t>(wxNOT_FOUND))
+            {
+                wxMenu *newSubMenu = new wxMenu;
+                wxMenuItem *newItem = new wxMenuItem(menu, item->GetId(), item->GetText(), item->GetHelp(),
+                                                     item->IsCheckable(), newSubMenu);
+                menu->Insert(pos, newItem);
+
+                menu->Destroy(item);
+                return newItem->GetSubMenu();
             }
         }
         return item ? item->GetSubMenu() : nullptr;

--- End code ---

Jenna:
I do not get a crash (latest nightly from my repo for debian testing svn r9176) on Ubuntu 13.04 with latest updates after I deleted (renamed) my ~/.codeblocks directory.
Older configuration from C::B 12.11-2 from Ubuntu repo leads to a crash with the new version. :-* :-* :-*

oBFusCATed:
What about the new version?
I'm going to commit it, because it fixes the gtk warnings.

Jenna:

--- Quote from: oBFusCATed on July 08, 2013, 01:35:24 am ---What about the new version?
I'm going to commit it, because it fixes the gtk warnings.

--- End quote ---
I did not test it, but you cast wxNOT_FOUND to size_t and you use the casted value for comparison.

Is this cast guaranteed to work correctly (or better as expected) with all compilers possibly used for building C::B ?

EDIT:
besides of this it seems to work here (fc19 64-bit with wx2.8 and gcc4.8), no more gtk-warnings/criticals.

By the way disabling and immediately reenabling the debugger-plugin leads to a cras, if I click on the debugger-menu.
If I close C::B between disabling and reenabling, it works correctly.
That also happens with trunk, so it is not (directly?) related.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version