summaryrefslogtreecommitdiff
path: root/src/editor/gui.cpp
diff options
context:
space:
mode:
authorkasull <qsullian@gmail.com>2026-03-03 18:49:43 -0500
committerkasull <qsullian@gmail.com>2026-03-03 18:49:43 -0500
commitbe91342733fd56d1e7bafe72e82a8ac4dc67b79d (patch)
tree0b87d812dd90b54df35279b06a7beca9de84c965 /src/editor/gui.cpp
parent5c4e9c8b140b14ba9671b8efcc47d71c6c4f2217 (diff)
fix use after freeui-rework
Diffstat (limited to 'src/editor/gui.cpp')
-rw-r--r--src/editor/gui.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/editor/gui.cpp b/src/editor/gui.cpp
index 04e69f1..ea03e8f 100644
--- a/src/editor/gui.cpp
+++ b/src/editor/gui.cpp
@@ -469,7 +469,7 @@ static GUI_EDITOR_TOOLBAR* gui_editor_toolbar( I32 x, I32 y, I32 w, I32 h, const
}
static void editor_raise_header_toolbar( GAME_EDITOR* e ) {
- if( !e || !e->gui.header_toolbar )
+ if( !e || !e->map || !e->wnd || !e->gui.header_toolbar )
return;
GUI_BASE* bar = e->gui.header_toolbar;
@@ -1071,7 +1071,7 @@ static void editor_layout_map_view( GAME_EDITOR* e ) {
void gui_editorwindow_draw_fn( void* ptr ) {
GUI_EDITORWINDOW* wnd = (GUI_EDITORWINDOW*)ptr;
editor_raise_header_toolbar( editor );
- GUI_BASE* toolbar = editor ? editor->gui.header_toolbar : 0;
+ GUI_BASE* toolbar = ( editor && editor->map ) ? editor->gui.header_toolbar : 0;
GUI_EDITOR_TOOLBAR* tbar = (GUI_EDITOR_TOOLBAR*)toolbar;
U8 menu_open = tbar && ( tbar->file_open || tbar->edit_open );
F32 saved_mx = input.mouse.pos.x;
@@ -1107,7 +1107,7 @@ static void gui_editorwindow_input_fn( void* ptr ) {
GUI_EDITORWINDOW* wnd = (GUI_EDITORWINDOW*)ptr;
editor_raise_header_toolbar( editor );
- GUI_BASE* toolbar = editor ? editor->gui.header_toolbar : 0;
+ GUI_BASE* toolbar = ( editor && editor->map ) ? editor->gui.header_toolbar : 0;
if( toolbar && toolbar->enabled && toolbar->input_fn )
toolbar->input_fn( toolbar );
@@ -1246,16 +1246,7 @@ void editor_create_map_view( GAME_EDITOR* e ) {
gui_free( *ptr );
} );
w->children.clear();
- e->gui.assets = 0;
- e->gui.status = 0;
- e->gui.assets_scroll = 0;
- e->gui.header_toolbar = 0;
- e->gui.header_viewtype_label = 0;
- e->gui.header_back = 0;
- e->gui.header_mode_2d = 0;
- e->gui.header_mode_3d = 0;
- e->gui.header_mode_sim = 0;
- e->gui.header_viewtype = 0;
+ editor_clear_gui_state_refs( e );
e->gui.view2d_type = EDITOR_2DVIEW_TOP_DOWN;
e->gui.view_mode = EDITOR_VIEWMODE_2D;