From 518e7c92b8aa4c8893cff7f5f9f36ccc8918cd59 Mon Sep 17 00:00:00 2001 From: pabs Date: Sun, 30 Mar 2008 11:37:16 +0000 Subject: [PATCH] Fix some crashes when the images for the splash screen are not available git-svn-id: http://svn.voria.com/code@1942 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/splash.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/synfig-studio/trunk/src/gtkmm/splash.cpp b/synfig-studio/trunk/src/gtkmm/splash.cpp index 82ced15..19750c7 100644 --- a/synfig-studio/trunk/src/gtkmm/splash.cpp +++ b/synfig-studio/trunk/src/gtkmm/splash.cpp @@ -183,8 +183,12 @@ Splash::Splash(): splash_image->set_padding(0,0); // Get the image size - int image_w = splash_image->get_pixbuf()->get_width(); - int image_h = splash_image->get_pixbuf()->get_height(); + int image_w = 350; int image_h = 0; + Glib::RefPtr pixbuf = splash_image->get_pixbuf(); + if( pixbuf ){ + pixbuf->get_width(); + pixbuf->get_height(); + } // Create the progress bar progressbar = manage(new class Gtk::ProgressBar()); @@ -197,7 +201,7 @@ Splash::Splash(): // Create the Gtk::Fixed container and put all of the widgets into it Gtk::Fixed* fixed = manage(new class Gtk::Fixed()); - fixed->put(*splash_image, 0, 0); + if( pixbuf ) fixed->put(*splash_image, 0, 0); fixed->put(*progressbar, 0, image_h+24); fixed->put(*tasklabel, 0, image_h); @@ -213,11 +217,15 @@ Splash::Splash(): set_resizable(false); set_type_hint(Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN); set_auto_startup_notification(false); - set_icon_from_file(imagepath+"synfig_icon."+IMAGE_EXT); + try { + set_icon_from_file(imagepath+"synfig_icon."+IMAGE_EXT); + } catch(...) { + synfig::warning("Unable to open "+imagepath+"synfig_icon."+IMAGE_EXT); + } add(*frame); // show everything off - splash_image->show(); + if( pixbuf ) splash_image->show(); fixed->show(); frame->show(); -- 2.7.4