Umm wouldn't this be more appropriate in the EditorManager destructor?
if (m_pNotebook)
m_pNotebook->Destroy();
Please pardon my ignorance if this is bad code...... :lol:
Also it's totaly legal to "delete" a null pointer. All the problems arise from the fact that including myself many forget to set the pointer to null after deletion.
Right. Actually everybody should use something like this all the time:
template<typename T> void Delete(T *p) {delete p; p = 0;};
Hmm... I really wonder why nobody does that. Something must be fundamentally wrong with this, that would be just too simple... :?:
One could use reference counted smart pointers to avoid above problem, too, of course.
If fact, I believe an object having a Destroy() function should necessarily be reference counted - if it only wraps around a plain normal delete, then it is actually not of much use to have such a function.
I'm not quite sure what behaviour is intended. But this problem can be fixed with this little patch:
Index: src/sdk/messagemanager.cpp
===================================================================
--- src/sdk/messagemanager.cpp (revision 2417)
+++ src/sdk/messagemanager.cpp (working copy)
@@ -332,7 +332,7 @@
if (show && !ls->visible)
{
// show
- m_pNotebook->InsertPage(id, log, ls->title, false);
+ m_pNotebook->InsertPage(id, log, ls->title, true);
SetLogImage(id, ls->bitmap);
ls->visible = true;
This way the tab that will be shown again gets selected. I think this is not the originally intended behaviour but it at least works without the problem described here.
HEAD updated to wxFNB 1.30.
Yay! 8)
Aww bugs.... :P
Do this.
1. Right click on a messages tab.
2. Show/Hide a visible tab.
3. Show/Hide the same tab (making it visible).
4. Not good. :P
Fix.
Index: src/sdk/messagemanager.cpp
===================================================================
--- src/sdk/messagemanager.cpp (revision 2421)
+++ src/sdk/messagemanager.cpp (working copy)
@@ -337,8 +337,6 @@
SetLogImage(id, ls->bitmap);
ls->visible = true;
- log->Show(false);
-
if (id == m_DebugLog)
cfg->Write(_T("/has_debug_log"), (bool)true);
}
@@ -350,8 +348,6 @@
m_pNotebook->RemovePage(id);
ls->visible = false;
- log->Show(false);
-
if (id == m_DebugLog)
cfg->Write(_T("/has_debug_log"), (bool)false);
}
Posted to the tracker.
https://developer.berlios.de/patch/index.php?func=detailpatch&patch_id=1038&group_id=5358