Installed new NB (I hadn't been updating since 1 year). Loaded an existing project made with the previous version (13620), got a crash. Attached rpt and crash window
if ( currentLayout.BeforeFirst('|').StartsWith(_("layout2")) ||
will be always false because wx3.3 saves layouts in the new "layout3" format. I think this is the root cause of the problem, but I am still using wx3.2 and currently have no time to check.
In any case, the translation macro should be removed from this line and the next one.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Phase 1 of fix to layout asserts.
Rewrite of cbauibook::LoadPerspective() is working now without asserts.
But now getting asserts when closing the workspace. Indicates progress I suppose.
Conversation Context Summary (Gemini)
The Core Goal
We are rewriting cbAuiNotebook::LoadPerspective() in Code::Blocks to make it compatible with wxWidgets 3.3.
Why the Legacy Code Failed
Invariant Violations: The legacy code manually called ctrl->RemovePage(wnd) while leaving the pages registered in the notebook's master info array (m_tabs). In wx3.3, this breaks an internal rule: Every registered window page must belong to exactly one structural tab control layout at all times. This caused massive layout engine assertions.
Layout Serialization Shift: wxWidgets 3.3 updated its inner framing format from layout2 to layout3, causing old string filters to bypass cleanup code and pass corrupt configuration streams down to m_mgr.LoadPerspective().
The Reimplemented Strategy
We flipped the logic to use high-level, compliant wx3.3 interfaces:
Snapshot: We copy references to all open window pointers, captions, and bitmaps into a temporary snapshot vector (windowSnapshots).
Safe Detach: We loop backwards and call this->RemovePage(i) to clear out all structural tab groups cleanly without deleting the actual file view windows.
Parse & Rebuild: We loop through the .layout string tokens, match them to our 살아있는 (live) windows inside the snapshot, strip stale wx3.3 event handler wrappers (RemoveEventHandler), and rebuild the layout by cleanly calling this->AddPage() and this->Split().
🔍 Shifting to the New Issue: Close Workspace Asserts
Now that your perspective-loading loop is stable, closing the workspace causes new assertions. When a workspace closes, Code::Blocks unloads projects, destroys the remaining tabs, and tears down the layout manager.
Fix code to set the active tab when closing and set it when loading in cbauibook::LoadPerspective() .
Replaces the previous patch file.
This still leaves anomilies in art providers and strange double tabs for ToDo log.
1) missing x in editor tabs
2) split testing
Context & Bug Diagnoses Summary (Gemini)
Application Shutdown Crash
Symptoms: assert "page_idx < m_tabs.GetPageCount()" inside GetPage() during full Code::Blocks exit.
Root Cause: Top-down destruction in wxWidgets 3.3 means underlying notebook file windows (pageItem->window) are deleted before InfoPane finishes its final layout tracking pass. GetPageIndex() returns wxNOT_FOUND (-1), which casts to a massive unsigned index, triggering the out-of-bounds assert.
Tab Focus Resetting to First Tab On Load
Symptoms: Layout string missing tab tokens before the @ symbol; active tabs defaulting to index 0 on reload.
Root Causes: 1. cbAuiNotebook::SavePerspective() was filtering out the primary layout pane because wxWidgets 3.3 hardcodes its master name to "dummy".
this->RemovePage() during layout reconstruction wiped out the custom page tooltips. Because the editors weren't re-created, the tooltips stayed blank, causing UniqueIdFromTooltip() to fail on subsequent saves.
LoadPerspective() was evaluating UniqueIdFromTooltip() against the tab's caption instead of its tooltip.
Hi Elena,
Similar crash was discussed recently in forum . Could you please try below suggestion from MaxGaspa until this is propery fixed?
In Settings->Environment Settings->Notebooks Appearance->Tab Style, use Default or Simple tabs.
Last edit: Christo 2026-06-07
This line in cbauibook.cpp:780
will be always false because wx3.3 saves layouts in the new "layout3" format. I think this is the root cause of the problem, but I am still using wx3.2 and currently have no time to check.
In any case, the translation macro should be removed from this line and the next one.
Replacing the while() in line 778 with this
should fix the issue.
Patch commited in [r13857], it may not fix the issue but is needed anyway.
Related
Commit: [r13857]
Phase 1 of fix to layout asserts.
Rewrite of cbauibook::LoadPerspective() is working now without asserts.
But now getting asserts when closing the workspace. Indicates progress I suppose.
Conversation Context Summary (Gemini)
We are rewriting cbAuiNotebook::LoadPerspective() in Code::Blocks to make it compatible with wxWidgets 3.3.
Why the Legacy Code Failed
Invariant Violations: The legacy code manually called ctrl->RemovePage(wnd) while leaving the pages registered in the notebook's master info array (m_tabs). In wx3.3, this breaks an internal rule: Every registered window page must belong to exactly one structural tab control layout at all times. This caused massive layout engine assertions.
Layout Serialization Shift: wxWidgets 3.3 updated its inner framing format from layout2 to layout3, causing old string filters to bypass cleanup code and pass corrupt configuration streams down to m_mgr.LoadPerspective().
The Reimplemented Strategy
We flipped the logic to use high-level, compliant wx3.3 interfaces:
Snapshot: We copy references to all open window pointers, captions, and bitmaps into a temporary snapshot vector (windowSnapshots).
Safe Detach: We loop backwards and call this->RemovePage(i) to clear out all structural tab groups cleanly without deleting the actual file view windows.
Parse & Rebuild: We loop through the .layout string tokens, match them to our 살아있는 (live) windows inside the snapshot, strip stale wx3.3 event handler wrappers (RemoveEventHandler), and rebuild the layout by cleanly calling this->AddPage() and this->Split().
🔍 Shifting to the New Issue: Close Workspace Asserts
Now that your perspective-loading loop is stable, closing the workspace causes new assertions. When a workspace closes, Code::Blocks unloads projects, destroys the remaining tabs, and tears down the layout manager.
Fix code to set the active tab when closing and set it when loading in cbauibook::LoadPerspective() .
Replaces the previous patch file.
This still leaves anomilies in art providers and strange double tabs for ToDo log.
1) missing x in editor tabs
2) split testing
Context & Bug Diagnoses Summary (Gemini)
Application Shutdown Crash
Symptoms: assert "page_idx < m_tabs.GetPageCount()" inside GetPage() during full Code::Blocks exit.
Root Cause: Top-down destruction in wxWidgets 3.3 means underlying notebook file windows (pageItem->window) are deleted before InfoPane finishes its final layout tracking pass. GetPageIndex() returns wxNOT_FOUND (-1), which casts to a massive unsigned index, triggering the out-of-bounds assert.
Tab Focus Resetting to First Tab On Load
Symptoms: Layout string missing tab tokens before the @ symbol; active tabs defaulting to index 0 on reload.
Root Causes: 1. cbAuiNotebook::SavePerspective() was filtering out the primary layout pane because wxWidgets 3.3 hardcodes its master name to "dummy".
Last edit: pecan 5 days ago
Final patch (I hope) for svn 13883. It fixes assets in wx 3.3.2 for tabs in cbauibook, infopane, main, notebookstyles.
Patch has been deleted so it can be updated to current HEAD
Last edit: pecan 1 day ago