[PATCH] tablet-shell client:fix one seg-fault error

juan.j.zhao at linux.intel.com juan.j.zhao at linux.intel.com
Wed Jun 20 19:29:27 PDT 2012


From: Juan Zhao <juan.j.zhao at linux.intel.com>

When the icon provided in weston.ini is not available, it will report a segfault error.
Check the icon at first.
backtrace:
*INT_cairo_surface_status (surface=0x0) at cairo-surface.c:259
259     {
(gdb) bt
 #0  *INT_cairo_surface_status (surface=0x0) at cairo-surface.c:259
 #1  0x0804baca in tablet_shell_add_launcher (data=0xbfb800ec)
     at tablet-shell.c:404
 #2  launcher_section_done (data=0xbfb800ec) at tablet-shell.c:434
 #3  0x08051121 in parse_config_file (
     path=0x8b96c10 "/root/.config/weston.ini", sections=0x8053c80,
     num_sections=2, data=0xbfb800ec) at config-parser.c:113
 #4  0x0804c0f9 in main (argc=1, argv=0xbfb801d4) at tablet-shell.c:480

Signed-off-by: Juan Zhao <juan.j.zhao at linux.intel.com>
---
 clients/tablet-shell.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c
index 0f58d5c..5a2bd34 100644
--- a/clients/tablet-shell.c
+++ b/clients/tablet-shell.c
@@ -401,7 +401,8 @@ tablet_shell_add_launcher(struct tablet *tablet,
 	launcher = malloc(sizeof *launcher);
 	launcher->path = strdup(path);
 	launcher->icon = load_cairo_surface(icon);
-	if (cairo_surface_status (launcher->icon) != CAIRO_STATUS_SUCCESS) {
+	if ( !launcher->icon ||
+	     cairo_surface_status (launcher->icon) != CAIRO_STATUS_SUCCESS) {
 		fprintf(stderr, "couldn't load %s\n", icon);
 		free(launcher);
 		return;
-- 
1.7.11



More information about the wayland-devel mailing list