Patch #1774 2006-12-30 01:15
stahta01
Plugin disable Crash issue partial fix- Download
- 1774-Plugin_disable.patch (2.4 KB)
Index: src/sdk/menuitemsmanager.cpp
===================================================================
--- src/sdk/menuitemsmanager.cpp (revision 3424)
+++ src/sdk/menuitemsmanager.cpp (working copy)
@@ -67,7 +67,7 @@
{
if (!parent)
return 0;
- wxMenuItem* ni = new wxMenuItem(0L, id, caption, helptext);
+ wxMenuItem* ni = new wxMenuItem(parent, id, caption, helptext);
m_MenuItems.Add(ni);
parent->Insert(index, ni);
return ni;
@@ -177,7 +178,7 @@
{
if (needsSep)
{
- wxMenuItem* item = new wxMenuItem(0, wxID_SEPARATOR);
+ wxMenuItem* item = new wxMenuItem(menu, wxID_SEPARATOR);
menu->Insert(insert ? insertIndex : menu->GetMenuItemCount(), item);
}
@@ -189,7 +190,7 @@
else
{
wxMenu* sub = new wxMenu;
- wxMenuItem* item = new wxMenuItem(0, -1, current, wxEmptyString, wxITEM_NORMAL, sub);
+ wxMenuItem* item = new wxMenuItem(menu, -1, current, wxEmptyString, wxITEM_NORMAL, sub);
menu->Insert(insert ? insertIndex : menu->GetMenuItemCount(), item);
menu = sub;
}
Index: src/plugins/codecompletion/classbrowserbuilderthread.cpp
===================================================================
--- src/plugins/codecompletion/classbrowserbuilderthread.cpp (revision 3385)
+++ src/plugins/codecompletion/classbrowserbuilderthread.cpp (working copy)
@@ -167,7 +167,7 @@
void ClassBrowserBuilderThread::RemoveInvalidNodes(wxTreeCtrl* tree, wxTreeItemId parent)
{
- if (TestDestroy() || Manager::IsAppShuttingDown())
+ if (TestDestroy() || Manager::IsAppShuttingDown() || (!(parent.IsOk())) )
return;
// recursively enters all existing nodes and deletes the node if the token it references
@@ -175,7 +175,7 @@
// we 'll loop backwards so we can delete nodes without problems
wxTreeItemId existing = tree->GetLastChild(parent);
- while (existing)
+ while (existing.IsOk())
{
// recurse
if (tree->ItemHasChildren(existing))
@@ -427,7 +427,7 @@
void ClassBrowserBuilderThread::SelectNode(wxTreeItemId node)
{
- if (TestDestroy() || Manager::IsAppShuttingDown())
+ if (TestDestroy() || Manager::IsAppShuttingDown() || (!(node.IsOk())))
return;
m_pTreeBottom->Freeze();
History
stahta01 2006-12-30 01:19
Problem 1: Using wxMenuItem with NULL parent is NOT recommended, I belief it is causing issues on menuitem deletion.
Solution 1: Changed 0L to proper value.
Problem 2: Using NULL objects
Solution 2: Added tests for objects using IsOk()
Tim S
stahta01 2006-12-30 01:20
Please see thread http://forums.codeblocks.org/index.php?topic=4754 for info.
Tim S
stahta01 2006-12-30 10:43
This patch seems to reduce the crashing by about 80 percent except for the plugin Dev-C++ Devpak Updater is seems to have a major crash issue of its own. Tim S
killerbot 2006-12-30 16:47
looks/sounds (and seems to behave ;-) ) ok.
Applied.
Too bad not all crashes are gone yet. Probably some fundamental problem remains.