commit 1c640e4bbc5efa6e7a85456b54d1c86376e0ccc4
Author: Daniele Forsi <df...@sr...>
Date: Thu Mar 15 18:49:21 2012 +0100
Fix segfault when g_settings schema isn't installed
* src/anjuta-app.c
* Use a NULL safe string comparison function
Fixes:
Program received signal SIGSEGV, Segmentation fault.
(gdb) bt
#0 __GI___strcasecmp (s1=0x0, s2=0x805459c "Text") at strcasecmp.c:65
#1 0x08050d15 in on_gdl_style_changed (settings=0x80b6af0, key=0x8054609 "gdl-style", user_data=0x80c4008) at anjuta-app.c:243
src/anjuta-app.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/anjuta-app.c b/src/anjuta-app.c
index ea023f2..c51b75d 100644
--- a/src/anjuta-app.c
+++ b/src/anjuta-app.c
@@ -23,7 +23,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <signal.h>
-#include <string.h>
#include <ctype.h>
#include <sys/wait.h>
@@ -240,15 +239,15 @@ static void on_gdl_style_changed(GSettings* settings, const gchar* key, gpointer
gchar* pr_style = g_settings_get_string(settings, key);
- if (strcasecmp(pr_style, "Text") == 0)
+ if (g_strcmp0(pr_style, "Text") == 0)
style = GDL_SWITCHER_STYLE_TEXT;
- else if (strcasecmp(pr_style, "Icon") == 0)
+ else if (g_strcmp0(pr_style, "Icon") == 0)
style = GDL_SWITCHER_STYLE_ICON;
- else if (strcasecmp(pr_style, "Both") == 0)
+ else if (g_strcmp0(pr_style, "Both") == 0)
style = GDL_SWITCHER_STYLE_BOTH;
- else if (strcasecmp(pr_style, "Toolbar") == 0)
+ else if (g_strcmp0(pr_style, "Toolbar") == 0)
style = GDL_SWITCHER_STYLE_TOOLBAR;
- else if (strcasecmp(pr_style, "Tabs") == 0)
+ else if (g_strcmp0(pr_style, "Tabs") == 0)
style = GDL_SWITCHER_STYLE_TABS;
g_object_set(G_OBJECT(app->layout_manager->master), "switcher-style", style, NULL);
|