News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

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

Started by Turbine, July 03, 2013, 01:46:39 PM

Previous topic - Next topic

Jenna


oBFusCATed

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


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!]

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.
(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!]

Jenna

#19
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.
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.

oBFusCATed

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!]

Jenna

Quote from: oBFusCATed on July 08, 2013, 10:45:47 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.

stahta01

Quote from: jens on July 08, 2013, 10:52:03 AM
Quote from: oBFusCATed on July 08, 2013, 10:45:47 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.

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++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

oBFusCATed

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!]