Patch #2885 2009-12-27 21:36
techy
Fixes for keybinder (debug13)- Download
- 2885-Fixes_for_keyb.patch (2.3 KB)
Index: src/plugins/contrib/keybinder/keybinder.cpp
===================================================================
--- src/plugins/contrib/keybinder/keybinder.cpp (revision 5986)
+++ src/plugins/contrib/keybinder/keybinder.cpp (working copy)
@@ -621,7 +621,10 @@
// create the wxCmd-derived class & init it
wxCmd* ret = fnc(cmdName, id);
- wxASSERT(ret); // for debug builds
+// ret == NULL can easily happen on runtime when dynamic menu entries are stored
+// into the config file and upon reload during startup the same entries don't
+// exist - usage of wxASSERT isn't probably a good idea here...
+// wxASSERT(ret); // for debug builds
if (!ret) return NULL; // for release builds
if (updateMnu) ret->Update();
@@ -2137,6 +2140,9 @@
if (p == NULL)
return wxTreeItemId(); // an empty wxTreeItemId is always invalid...
+ if (m_pCommandsTree->ItemHasChildren(selection))
+ return wxTreeItemId();
+
return selection;
}
// ----------------------------------------------------------------------------
@@ -2163,18 +2169,10 @@
bool wxKeyConfigPanel::IsSelectedValidCmd() const
// ----------------------------------------------------------------------------
{
-//// if (IsUsingTreeCtrl())
-//// return GetSelCmdId().IsOk();
-
if (IsUsingTreeCtrl())
- {
- // if tree item is a sub-menu don't allow key assignment //(pecan 2009/6/04)
- if (m_pCommandsTree->ItemHasChildren(m_pCommandsTree->GetSelection()))
- return false;
- return GetSelCmdId().IsOk();
- }
+ return GetSelCmdId().IsOk();
else
- return m_pCommandsList->GetSelection() >= 0;
+ return m_pCommandsList->GetSelection() >= 0;
}
// ----------------------------------------------------------------------------
Index: src/plugins/contrib/keybinder/cbkeybinder.cpp
===================================================================
--- src/plugins/contrib/keybinder/cbkeybinder.cpp (revision 5986)
+++ src/plugins/contrib/keybinder/cbkeybinder.cpp (working copy)
@@ -1046,7 +1046,6 @@
// deleteing the EvtHandler here will crash CB
// detach before removing the ed ptr
DetachEditor(thisWindow, /*DeleteEvtHander*/false);
- m_EditorPtrs.Remove(thisWindow);
#ifdef LOGGING
LOGIT( _T("OnWindowDestroyEvent Removed %p"), thisWindow);
History
techy 2009-12-27 21:49
There are several problems in keybinder:
There is one wxASSERT that is too strict - assertion violation can happen under normal conditions on runtime so the assert shouldn't be there (for more explanation see the patch itself).
Commit 5626 didn't take into account that there is no selection and m_pCommandsTree->GetSelection() doesn't return a valid node. Instead of adding the test here however, it is better to move the test whether we are a leaf of the tree inside GetSelCmdId where the validity of the selection is already tested.
mortenmacfly 2009-12-28 19:56
I leave this open and un-assigned for the (active) maintainer of this plugin to take action. If nothing happens for a while, drop me a note (just a comment here).
mortenmacfly 2010-02-24 12:22
Of interest to Pecan.
pecan 2010-03-03 20:34
Applied svn 6186
Thanks