I have written a simple program to demonstrate the problem. It is given below. The program must be run like: pixbuferror.exe test.jpg. 1. If test.jpg does not exist, I get this : "terminate called after throwing an instance of 'Glib::FileError'" 2. If test.jpg does exit but is not a valid file : "terminate called after throwing an instance of 'Glib::Error'" 3. If test.jpg is valid, the program shows "Succes!!!" indicating that it at least did not crash. It does show some glibmm warnings but that is because things are probably not initialised properly. Since I really do not know how to initialise gdk and friends properly, I have stopped trying and hope you can work with this little program. In any case, the program does not catch exceptions which I find really strange. Thanks for all the help, Johan ---------------------------- the program: pixbuferror.cpp ---------------------------- #include <glibmm/ustring.h> #include <gdkmm/pixbuf.h> #include <gtk/gtk.h> int main(int argc, char **argv) { Glib::ustring fileName = argv[1]; //Get some image info. Smart pointer does not need to be deleted Glib::RefPtr<Gdk::Pixbuf> img(NULL); try { img = Gdk::Pixbuf::create_from_file(fileName); } catch (const Glib::FileError & e) { g_message("caught Glib::FileError"); return -1; } catch (const Gdk::PixbufError & e) { g_message("Gdk::PixbufError"); return -1; } catch (...) { g_message("Caught ... "); return -1; } g_message("Succes!!!"); return 0; } -------------------------------- > -----Original Message----- > From: Murray Cumming [mailto:murrayc murrayc com] > Sent: zondag 18 november 2007 18:36 > To: Engelen, J.B.C. (Johan) > Cc: internalerror gmail com; gtkmm-list gnome org > Subject: RE: Unable to catch Gdk::PixbufError > > On Sun, 2007-11-18 at 18:27 +0100, J B C Engelen ewi utwente nl wrote: > > > -----Original Message----- > > > From: Milosz Derezynski [mailto:internalerror gmail com] > > > Sent: zondag 18 november 2007 18:21 > > > > > > As a shot off, i'd say this is not the code causing the actual > > > Pixbuf error; otherwise i wouldn't know how any exception can get > > > past a > > > catch(...) > > > > > > Are you definitely sure this is the code part causing the problem? > > > > 100% certain. > > I am really puzzled by it. > > You need to write a simple compilable test case to prove this then. > > -- > murrayc murrayc com > www.murrayc.com > www.openismus.com > >
Attachment:
pixbuferror.cpp
Description: pixbuferror.cpp