Author Topic: C::B crashing on start (Ubuntu 13.04 & Mint 15)  (Read 36562 times)

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: C::B crashing on start (Ubuntu 13.04 & Mint 15)
« Reply #15 on: July 04, 2013, 02:10:46 pm »
It might also be a wxWidgets bug.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: C::B crashing on start (Ubuntu 13.04 & Mint 15)
« Reply #16 on: July 05, 2013, 01:33:24 am »
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;
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: C::B crashing on start (Ubuntu 13.04 & Mint 15)
« Reply #17 on: July 08, 2013, 12:47:34 am »
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. :-* :-* :-*

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: C::B crashing on start (Ubuntu 13.04 & Mint 15)
« Reply #18 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: C::B crashing on start (Ubuntu 13.04 & Mint 15)
« Reply #19 on: July 08, 2013, 06:51:59 am »
What about the new version?
I'm going to commit it, because it fixes the gtk warnings.
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.
« Last Edit: July 08, 2013, 07:08:25 am by jens »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: C::B crashing on start (Ubuntu 13.04 & Mint 15)
« Reply #20 on: July 08, 2013, 10:45:47 am »
What are the exact steps to reproduce the problem?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: C::B crashing on start (Ubuntu 13.04 & Mint 15)
« Reply #21 on: July 08, 2013, 10:52:03 am »
What are the exact steps to reproduce the problem?
  • Go to "Plugins -> Manage plugins" and disable the debugger plugin.
  • Keep C::B open and reenable the plugin, it does not matter, whether the plugin-manager dialog is closed or not.
  • Click on the "Debug"-menu and C::B crashes.

I just tested it on windows with 12.11 and it happens here also.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: C::B crashing on start (Ubuntu 13.04 & Mint 15)
« Reply #22 on: July 08, 2013, 10:38:36 pm »
What are the exact steps to reproduce the problem?
  • Go to "Plugins -> Manage plugins" and disable the debugger plugin.
  • Keep C::B open and reenable the plugin, it does not matter, whether the plugin-manager dialog is closed or not.
  • Click on the "Debug"-menu and C::B crashes.

I just tested it on windows with 12.11 and it happens here also.

It does NOT happen for me; This is with just the Compiler and Debugger plug-ins activated on CB startup.
FYI: There was 3 or 4 plugins when activated cause CB to crash when other plugins are enabled/disabled.
I found this out about a year ago, I think I posted on it. I thought the issue was fixed.

Windows 7 32-bit testing CB 12.11.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: C::B crashing on start (Ubuntu 13.04 & Mint 15)
« Reply #23 on: July 08, 2013, 11:14:48 pm »
I've reproduced it and I'm fixing it right now.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]