Hi,<br><br>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?<br>
<br>Regards<br><br><div class="gmail_quote">On Mon, Jun 2, 2008 at 4:45 PM, Murray Cumming <<a href="mailto:murrayc@murrayc.com">murrayc@murrayc.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Mon, 2008-06-02 at 15:25 +0800, Dinh Khac Thanh wrote:<br>
> Hi all,<br>
><br>
> I got problem trying to load an image to a gtkmm using pixbuf's<br>
> create_from_file() in scratchbox. Here is the snippet of code:<br>
> std::auto_ptr<Glib::Error> err;<br>
><br>
> cout << "Start to load logo" <<endl;<br>
> image =<br>
> Gdk::Pixbuf::create_from_file("./icons/logo.png",err);<br>
> Glib::ustring err_str = err2->what();<br>
<br>
</div>You need to check pointers for NULL before dereferencing them. That's<br>
basic C++. For instance;<br>
<br>
if(err)<br>
std::cout << "Error message = " << err->what() << std::endl;<br>
else<br>
std::cout << "Succeeded" << std::endl;<br>
<div class="Ih2E3d"><br>
> cout << "Error message = " << err_str<<endl;<br>
> cout << "Finish to load logo" <<endl;<br>
> These lines are taken from a DrawingArea widget's constructor with<br>
> 'image' variable of type Glib::RefPtr<Gdk::Pixbuf>.<br>
><br>
> The output is:<br>
><br>
> Start to load i2rlogo<br>
> qemu: uncaught target signal 11 (Segmentation fault) - exiting<br>
><br>
> if I change the path to the image file that makes it wrong path, no<br>
> segmentation fault error:<br>
><br>
> Start to load logo<br>
> Error message = Failed to open file './icons/home.png': No such file<br>
> or directory<br>
> Finish to load logo<br>
><br>
> Could anyone suggest the reason behind this?<br>
><br>
> Regards<br>
><br>
</div>> _______________________________________________<br>
> maemo-developers mailing list<br>
> <a href="mailto:maemo-developers@maemo.org">maemo-developers@maemo.org</a><br>
> <a href="https://lists.maemo.org/mailman/listinfo/maemo-developers" target="_blank">https://lists.maemo.org/mailman/listinfo/maemo-developers</a><br>
<font color="#888888">--<br>
Murray Cumming<br>
<a href="mailto:murrayc@murrayc.com">murrayc@murrayc.com</a><br>
<a href="http://www.murrayc.com" target="_blank">www.murrayc.com</a><br>
<a href="http://www.openismus.com" target="_blank">www.openismus.com</a><br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Dinh Khac Thanh<br>You can do anything, but not everything<br>You miss 100 percent of the shots you never take