[maemo-developers] [gtkmm] Gdk::Pixbuf::create_from_file() segmentation fault in maemo

From: Dinh Khac Thanh thanhdk at gmail.com
Date: Mon Jun 2 12:18:02 EEST 2008
Hi,

Thank you for your fast reply, that deferencing one was correct. However the
error is still there after I changed it. I am suspecting that it is because
of thread conflict ( I tested the create_from_file without threading and it
worked fine). I am not sure if gtkmm is thread-safe or not?

Regards

On Mon, Jun 2, 2008 at 4:45 PM, Murray Cumming <murrayc at murrayc.com> wrote:

> On Mon, 2008-06-02 at 15:25 +0800, Dinh Khac Thanh wrote:
> > Hi all,
> >
> > I got problem trying to load an image to a gtkmm using pixbuf's
> > create_from_file() in scratchbox. Here is the snippet of code:
> >   std::auto_ptr<Glib::Error> err;
> >
> >             cout << "Start to load logo" <<endl;
> >             image =
> > Gdk::Pixbuf::create_from_file("./icons/logo.png",err);
> >             Glib::ustring err_str = err2->what();
>
> You need to check pointers for NULL before dereferencing them. That's
> basic C++. For instance;
>
> if(err)
>  std::cout << "Error message = " << err->what() << std::endl;
> else
>  std::cout << "Succeeded" << std::endl;
>
> >             cout << "Error message = " << err_str<<endl;
> >             cout << "Finish to load logo" <<endl;
> > These lines are taken from a DrawingArea widget's constructor with
> > 'image' variable of type Glib::RefPtr<Gdk::Pixbuf>.
> >
> > The output is:
> >
> > Start to load i2rlogo
> > qemu: uncaught target signal 11 (Segmentation fault) - exiting
> >
> > if I change the path to the image file that makes it wrong path, no
> > segmentation fault error:
> >
> > Start to load logo
> > Error message = Failed to open file './icons/home.png': No such file
> > or directory
> > Finish to load logo
> >
> > Could anyone suggest the reason behind this?
> >
> > Regards
> >
> > _______________________________________________
> > maemo-developers mailing list
> > maemo-developers at maemo.org
> > https://lists.maemo.org/mailman/listinfo/maemo-developers
> --
> Murray Cumming
> murrayc at murrayc.com
> www.murrayc.com
> www.openismus.com
>
>


-- 
Dinh Khac Thanh
You can do anything, but not everything
You miss 100 percent of the shots you never take
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maemo.org/pipermail/maemo-developers/attachments/20080602/fd653bc4/attachment.htm 
More information about the maemo-developers mailing list