From c53dd6e7bf7268c17fbdeeef05ec65b81d9e5c2a Mon Sep 17 00:00:00 2001 From: Michael Jennings Date: Tue, 7 Dec 1999 21:04:58 +0000 Subject: [PATCH] Tue Dec 7 18:02:22 PST 1999 (KainX) Fixed a seg fault in E-Mountbox if the images in the config file aren't found. It first falls back on the compiled-in defaults, and if that doesn't work either, it exits with an error. SVN revision: 1545 --- ChangeLog | 9 +++++++++ epplets/E-Mountbox.c | 20 +++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index aae68d3..a7ca9f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1461,3 +1461,12 @@ Also, I modified E-Slides and E-NetGraph so that if the config file or the default settings don't provide a valid image directory (for E-Slides) or a valid network interface (E-NetGraph), rather than immediately exiting, you will be presented with the config dialog. Very handy. + +------------------------------------------------------------------------------- + +Tue Dec 7 18:02:22 PST 1999 +(KainX) + +Fixed a seg fault in E-Mountbox if the images in the config file aren't found. +It first falls back on the compiled-in defaults, and if that doesn't work +either, it exits with an error. diff --git a/epplets/E-Mountbox.c b/epplets/E-Mountbox.c index 297ab65..11c72fd 100644 --- a/epplets/E-Mountbox.c +++ b/epplets/E-Mountbox.c @@ -746,42 +746,37 @@ SetupGraphx(void) /* load all images, scaled appropriately */ memset(images, 0, MAXTYPE * sizeof(ImlibImage*)); tmp = Imlib_load_image(id, Epplet_query_config("CD_IMAGE")); - if (tmp) + if (tmp || (tmp = Imlib_load_image(id, defaults[TYPE_CD].value))) { images[TYPE_CD] = Imlib_clone_scaled_image(id, tmp, 44, 32); Imlib_destroy_image(id, tmp); - tmp = NULL; } tmp = Imlib_load_image(id, Epplet_query_config("HD_IMAGE")); - if (tmp) + if (tmp || (tmp = Imlib_load_image(id, defaults[TYPE_HD].value))) { images[TYPE_HD] = Imlib_clone_scaled_image(id, tmp, 44, 32); Imlib_destroy_image(id, tmp); - tmp = NULL; } tmp = Imlib_load_image(id, Epplet_query_config("FD_IMAGE")); - if (tmp) + if (tmp || (tmp = Imlib_load_image(id, defaults[TYPE_FD].value))) { images[TYPE_FD] = Imlib_clone_scaled_image(id, tmp, 44, 32); Imlib_destroy_image(id, tmp); - tmp = NULL; } tmp = Imlib_load_image(id, Epplet_query_config("ZIP_IMAGE")); - if (tmp) + if (tmp || (tmp = Imlib_load_image(id, defaults[TYPE_ZIP].value))) { images[TYPE_ZIP] = Imlib_clone_scaled_image(id, tmp, 44, 32); Imlib_destroy_image(id, tmp); - tmp = NULL; } tmp = Imlib_load_image(id, Epplet_query_config("BG_IMAGE")); - if (tmp) + if (tmp || (tmp = Imlib_load_image(id, defaults[TYPE_BG].value))) { sscanf(Epplet_query_config("BG_BORDER"), "%i %i %i %i", &(border.left), &(border.right), &(border.top), &(border.bottom)); Imlib_set_image_border(id, tmp, &border); images[TYPE_BG] = Imlib_clone_scaled_image(id, tmp, 44 * num_tiles, 32); Imlib_destroy_image(id, tmp); - tmp = NULL; } /* see if we got all of them */ @@ -789,8 +784,11 @@ SetupGraphx(void) check = (check && images[i]); if (!check) { + /* Even the fallbacks didn't work. If we don't exit + here, we'll seg fault about 60 lines down. -- mej */ Epplet_dialog_ok("Could not load all images."); - /* should I abort here ? .... hmmm dunno yet */ + Esync(); + exit(-1); } /* set tile images according to mountpoint types */