tablet-shell client:fix one seg-fault error

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@linux.intel.com>
Juan Zhao 12 years ago committed by Kristian Høgsberg
parent 88fd40815a
commit 8634f51b63
  1. 3
      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;

Loading…
Cancel
Save