Skip to content

Fix blank main page caused by Dock.load_state() DrawList corruption#46

Merged
ZhangHanDong merged 2 commits intomainfrom
fix/dock-load-state-drawlist-corruption
Apr 3, 2026
Merged

Fix blank main page caused by Dock.load_state() DrawList corruption#46
ZhangHanDong merged 2 commits intomainfrom
fix/dock-load-state-drawlist-corruption

Conversation

@ZhangHanDong
Copy link
Copy Markdown

Summary

  • Fix critical rendering bug where the main content area (Dock with rooms list + room tabs) renders as completely blank after app restart
  • Root cause: Dock.load_state() destroys DrawList2d objects during event handling, corrupting Makepad's internal DrawList references
  • Replace dock.load_state() with programmatic tab recreation via close_all_tabs() + focus_or_create_tab()

Details

When restoring persisted dock state, Dock.load_state() calls self.tab_bars.clear() which drops TabBarWrap instances containing DrawList2d. This frees the DrawList pool entries (incrementing generation), but the rendering pipeline still holds stale DrawListId references from the previous frame, causing massive Drawlist id generation wrong errors.

Before fix: ~50+ DrawList errors per frame, blank main page
After fix: 0 DrawList errors, all rooms render correctly

Known limitations

  • Custom splitter positions (sidebar width) reset to default 300px on restart
  • Multi-pane layouts (drag-created split views) not restored on restart
  • These are acceptable trade-offs until the upstream Makepad Dock.load_state() bug is fixed

Fixes #45

Test plan

  • Start app with existing persisted state → rooms render, no DrawList errors
  • Start app without persisted state → default layout renders correctly
  • Saved room tabs restored in correct order
  • Previously selected room re-selected on restore
  • Space switching preserves tabs per space
  • Logout resets to default layout

🤖 Generated with Claude Code

ZhangHanDong and others added 2 commits April 4, 2026 02:15
Dock.load_state() destroys DrawList2d objects by clearing tab_bars during
event handling, but the rendering pipeline still holds stale DrawListId
references from the previous frame. This causes massive "Drawlist id
generation wrong" errors and a completely blank main content area.

Replace dock.load_state() in load_dock_state_from() with programmatic
tab recreation via close_all_tabs() + focus_or_create_tab(), which uses
the Dock's normal widget API and avoids direct DrawList destruction.

Fixes #45

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Author

@ZhangHanDong ZhangHanDong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ZhangHanDong ZhangHanDong merged commit bbd9983 into main Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dock.load_state() causes DrawList corruption, rendering blank main page

1 participant