Menu

#1605 Crash on loading existing project (svn 13855)

Undefined
open
nobody
None
Undefined
2 days ago
2026-06-06
Elena
No

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

2 Attachments

Discussion

  • Christo

    Christo - 2026-06-07

    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
  • Miguel Gimenez

    Miguel Gimenez - 2026-06-08

    This line in cbauibook.cpp:780

                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.

     
  • Miguel Gimenez

    Miguel Gimenez - 2026-06-09

    Replacing the while() in line 778 with this

            while (!currentLayout.empty())
            {
                if ( currentLayout.BeforeFirst('|').StartsWith("layout") ||
                     currentLayout.BeforeFirst('|').StartsWith("name=dummy") )
                {
                    currentLayout = currentLayout.AfterFirst(('|'));
                    currentLayout.Trim();
                    currentLayout.Trim(true);
                }
                else
                {
                    wxString pane_part = currentLayout.BeforeFirst('|');
                    if (pane_part.StartsWith("dock_size"))  // skip layout3 dock info
                        break;
    
                    pane_part.Trim();
                    pane_part.Trim(true);
                    if (!pane_part.empty())
                        tempLayout += pane_part + wxT("|");
    
                    currentLayout = currentLayout.AfterFirst('|');
                    currentLayout.Trim();
                    currentLayout.Trim(true);
                }
            }
    

    should fix the issue.

     
  • Miguel Gimenez

    Miguel Gimenez - 2026-06-10

    Patch commited in [r13857], it may not fix the issue but is needed anyway.

     

    Related

    Commit: [r13857]

  • pecan

    pecan - 5 days ago

    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)

    1. The Core Goal

    We are rewriting cbAuiNotebook::LoadPerspective() in Code::Blocks to make it compatible with wxWidgets 3.3.

    1. 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().

    2. 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.

     
  • pecan

    pecan - 5 days ago

    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)

    1. 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.

    2. 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".

      1. 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.
      2. LoadPerspective() was evaluating UniqueIdFromTooltip() against the tab's caption instead of its tooltip.
     

    Last edit: pecan 5 days ago
  • pecan

    pecan - 2 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

Log in to post a comment.

Auth0 Logo