mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Fix potential crash when attempting to free default font
Before setting a new font we try to free the existing font. Sadly if no config value is set for the default font, we assign a string literal. Which of course means that subsurface dumps core when trying to free it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b4c11a7ed3
commit
1a6cf2f128
3 changed files with 3 additions and 3 deletions
2
linux.c
2
linux.c
|
@ -88,7 +88,7 @@ void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
|||
GtkWidget *vbox, GtkUIManager *ui_manager)
|
||||
{
|
||||
if (!divelist_font)
|
||||
divelist_font = DIVELIST_DEFAULT_FONT;
|
||||
divelist_font = strdup(DIVELIST_DEFAULT_FONT);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
|
|
2
macos.c
2
macos.c
|
@ -116,7 +116,7 @@ void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
|||
GtkWidget *menu_item, *sep;
|
||||
|
||||
if (!divelist_font)
|
||||
divelist_font = DIVELIST_MAC_DEFAULT_FONT;
|
||||
divelist_font = strdup(DIVELIST_MAC_DEFAULT_FONT);
|
||||
g_object_set(G_OBJECT(settings), "gtk-font-name", UI_FONT, NULL);
|
||||
|
||||
osx_app = g_object_new(GTK_TYPE_OSX_APPLICATION, NULL);
|
||||
|
|
|
@ -155,7 +155,7 @@ void subsurface_ui_setup(GtkSettings *settings, GtkWidget *menubar,
|
|||
GtkWidget *vbox, GtkUIManager *ui_manager)
|
||||
{
|
||||
if (!divelist_font)
|
||||
divelist_font = DIVELIST_DEFAULT_FONT;
|
||||
divelist_font = strdup(DIVELIST_DEFAULT_FONT);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), menubar, FALSE, FALSE, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue