Provide a fallback for gtk-missing-image in case it is not in IconTheme. Fixes crash when starting gelide: terminate called after throwing an instance of 'Gtk::IconThemeError' Aborted https://sourceforge.net/tracker/?group_id=213712&atid=1026806&aid=3519711 https://sourceforge.net/p/gelide/bugs/17/ https://sourceforge.net/p/gelide/code/ci/495deb1b8ea05bb33cde70baf2201ea726ccb603/ --- src/ui/info_pannel.cpp +++ src/ui/info_pannel.cpp @@ -407,7 +407,9 @@ void CInfoPannel::initDescription(void){ } void CInfoPannel::initImages(void){ + Glib::RefPtr l_icon_theme; Gtk::Image* l_i; + bool l_continue; l_i = Gtk::manage(new Gtk::Image()); @@ -419,7 +421,34 @@ void CInfoPannel::initImages(void){ m_notebook_images.append_page(m_image_media, _("Media")); //m_default = Gdk::Pixbuf::create_from_file(GELIDE_DEFAULT_IMAGE); - m_default = Gtk::IconTheme::get_default()->load_icon("gtk-missing-image", 200, Gtk::ICON_LOOKUP_USE_BUILTIN); + //m_default = Gtk::IconTheme::get_default()->load_icon("gtk-missing-image", 200, Gtk::ICON_LOOKUP_USE_BUILTIN); + + + l_icon_theme = Gtk::IconTheme::get_default(); + l_continue = false; + // Comprobamos si se pudo obtener el icontheme + if(l_icon_theme){ + // Intentamos cargar el icono + try{ + m_default = l_icon_theme->load_icon("gtk-missing-image", 200, Gtk::ICON_LOOKUP_USE_BUILTIN); + l_continue = true; + } + catch(...){ + l_continue = false; + } + } + // Si no se pudo añadir el icono del tema, lo añadimos del fichero + if(!l_continue){ + try + { + m_default = Gdk::Pixbuf::create_from_file(GELIDE_UI_ICONS "gelide-no-image.png"); + } + catch(const Glib::Exception& l_exception) + { + GELIDE_WARNING("InfoPannel loading default image (" << l_exception.what().c_str() << ")"); + return; + } + } m_pixbuf_snapshot = m_default->copy(); m_pixbuf_tittle = m_default->copy(); --- ui/icons/Makefile.am +++ ui/icons/Makefile.am @@ -12,6 +12,7 @@ gelide-favorite.png \ gelide-horizontal-browser.png \ gelide-import-systems.png \ + gelide-no-image.png \ gelide-played.png \ gelide-rank.png \ gelide-show-browser.png \