summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Martynov <[email protected]>2014-11-24 22:46:51 -0500
committerNikolay Martynov <[email protected]>2014-11-24 22:46:51 -0500
commitbb659a752efbeedbe60fb6df5541a57c95777279 (patch)
treee4b52ccaa5673fe6d82c0738f3fdd3282cf1dec9
parent1c238948e901162dc76e513ee397bcbd8085fe01 (diff)
downloadmate-terminal-bb659a752efbeedbe60fb6df5541a57c95777279.tar.bz2
mate-terminal-bb659a752efbeedbe60fb6df5541a57c95777279.tar.xz
Properly check gdk_property_get result
Check return value of gdk_property_get in get_initial_workspace before using its result Current implementation segfaults from to time if terminal is started at X session startup Looks like #769947 bug in Debian describes same issue
-rw-r--r--src/terminal.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/terminal.c b/src/terminal.c
index a6bf43f..f9989a5 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -532,10 +532,10 @@ get_initial_workspace (void)
atom = gdk_atom_intern_static_string ("_NET_CURRENT_DESKTOP");
cardinal_atom = gdk_atom_intern_static_string ("CARDINAL");
- gdk_property_get (window, atom, cardinal_atom, 0, 8, FALSE, NULL, NULL, NULL, &data);
-
- ret = *(int *)data;
- g_free (data);
+ if (gdk_property_get (window, atom, cardinal_atom, 0, 8, FALSE, NULL, NULL, NULL, &data)) {
+ ret = *(int *)data;
+ g_free (data);
+ }
return ret;
}