Skip to content

Commit

Permalink
bugfix: Fixed returning to GUI triggered a segfault
Browse files Browse the repository at this point in the history
  • Loading branch information
midwan committed Oct 20, 2024
1 parent 3695d52 commit 5106b3b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/osdep/amiberry_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1488,7 +1488,11 @@ void apply_theme()
gcn::Widget::setGlobalForegroundColor(gui_foreground_color);
gcn::Widget::setGlobalBackgroundColor(gui_background_color);
gcn::Widget::setGlobalSelectionColor(gui_selection_color);
}

// Extra theme settings, that should be called separately from the above function
void apply_theme_extras()
{
if (selectors != nullptr)
{
selectors->setBaseColor(gui_base_color);
Expand Down
2 changes: 2 additions & 0 deletions src/osdep/gui/PanelThemes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ class ThemesActionListener : public gcn::ActionListener
{
gui_theme.font_size = std::stoi(txtThemeFontSize->getText());
apply_theme();
apply_theme_extras();
}
else if (source == cboThemePreset)
{
Expand All @@ -121,6 +122,7 @@ class ThemesActionListener : public gcn::ActionListener
std::strcpy(amiberry_options.gui_theme, theme.c_str());
load_theme(theme);
apply_theme();
apply_theme_extras();
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/osdep/gui/gui_handling.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ extern void save_theme(const std::string& theme_filename);
extern void load_theme(const std::string& theme_filename);
extern void load_default_theme();
extern void apply_theme();
extern void apply_theme_extras();

extern void SetLastActiveConfig(const char* filename);

Expand Down
3 changes: 3 additions & 0 deletions src/osdep/gui/main_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,9 @@ void gui_widgets_init()

selectors->setSize(SELECTOR_WIDTH, selectorsHeight);

// These need to be called after the selectors have been created
apply_theme_extras();

//--------------------------------------------------
// Initialize panels
//--------------------------------------------------
Expand Down

0 comments on commit 5106b3b

Please sign in to comment.