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 &lt;<a href="mailto:murrayc@murrayc.com">murrayc@murrayc.com</a>&gt; 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>
&gt; Hi all,<br>
&gt;<br>
&gt; I got problem trying to load an image to a gtkmm using pixbuf&#39;s<br>
&gt; create_from_file() in scratchbox. Here is the snippet of code:<br>
&gt; &nbsp; std::auto_ptr&lt;Glib::Error&gt; err;<br>
&gt;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Start to load logo&quot; &lt;&lt;endl;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image =<br>
&gt; Gdk::Pixbuf::create_from_file(&quot;./icons/logo.png&quot;,err);<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Glib::ustring err_str = err2-&gt;what();<br>
<br>
</div>You need to check pointers for NULL before dereferencing them. That&#39;s<br>
basic C++. For instance;<br>
<br>
if(err)<br>
 &nbsp;std::cout &lt;&lt; &quot;Error message = &quot; &lt;&lt; err-&gt;what() &lt;&lt; std::endl;<br>
else<br>
 &nbsp;std::cout &lt;&lt; &quot;Succeeded&quot; &lt;&lt; std::endl;<br>
<div class="Ih2E3d"><br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Error message = &quot; &lt;&lt; err_str&lt;&lt;endl;<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cout &lt;&lt; &quot;Finish to load logo&quot; &lt;&lt;endl;<br>
&gt; These lines are taken from a DrawingArea widget&#39;s constructor with<br>
&gt; &#39;image&#39; variable of type Glib::RefPtr&lt;Gdk::Pixbuf&gt;.<br>
&gt;<br>
&gt; The output is:<br>
&gt;<br>
&gt; Start to load i2rlogo<br>
&gt; qemu: uncaught target signal 11 (Segmentation fault) - exiting<br>
&gt;<br>
&gt; if I change the path to the image file that makes it wrong path, no<br>
&gt; segmentation fault error:<br>
&gt;<br>
&gt; Start to load logo<br>
&gt; Error message = Failed to open file &#39;./icons/home.png&#39;: No such file<br>
&gt; or directory<br>
&gt; Finish to load logo<br>
&gt;<br>
&gt; Could anyone suggest the reason behind this?<br>
&gt;<br>
&gt; Regards<br>
&gt;<br>
</div>&gt; _______________________________________________<br>
&gt; maemo-developers mailing list<br>
&gt; <a href="mailto:maemo-developers@maemo.org">maemo-developers@maemo.org</a><br>
&gt; <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