From faa082b064600b0b97105a8814e831ce6177a6a1 Mon Sep 17 00:00:00 2001 From: buliabyak Date: Fri, 20 Jun 2008 16:38:39 +0000 Subject: [PATCH] patch from 226459, approved by joel --- src/ui/dialog/filedialogimpl-win32.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/ui/dialog/filedialogimpl-win32.cpp b/src/ui/dialog/filedialogimpl-win32.cpp index d26762bd3..f9eab673a 100644 --- a/src/ui/dialog/filedialogimpl-win32.cpp +++ b/src/ui/dialog/filedialogimpl-win32.cpp @@ -938,18 +938,26 @@ bool FileOpenDialogImplWin32::set_image_preview() { const Glib::ustring path = utf16_to_ustring(_path_string, _MAX_PATH); + bool successful = false; + _mutex->lock(); - _preview_bitmap_image = Gdk::Pixbuf::create_from_file(path); - if(!_preview_bitmap_image) return false; - _preview_image_width = _preview_bitmap_image->get_width(); - _preview_document_width = _preview_image_width; - _preview_image_height = _preview_bitmap_image->get_height(); - _preview_document_height = _preview_image_height; + try { + _preview_bitmap_image = Gdk::Pixbuf::create_from_file(path); + if (_preview_bitmap_image) { + _preview_image_width = _preview_bitmap_image->get_width(); + _preview_document_width = _preview_image_width; + _preview_image_height = _preview_bitmap_image->get_height(); + _preview_document_height = _preview_image_height; + successful = true; + } + } + catch (const Gdk::PixbufError&) {} + catch (const Glib::FileError&) {} _mutex->unlock(); - return true; + return successful; } void FileOpenDialogImplWin32::render_preview() -- 2.30.2