<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">

<channel>
	<title>jjongsma &#187; gtkmm</title>
	<atom:link href="http://blogs.gnome.org/jjongsma/category/programming/gtkmm/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.gnome.org/jjongsma</link>
	<description>Hacking on GNOME, but with a healthy dose of C++</description>
	<lastBuildDate>Thu, 18 Aug 2011 14:47:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license>		<item>
		<title>How to waste an evening debugging the internals of glib&#8217;s qsort implementation</title>
		<link>http://blogs.gnome.org/jjongsma/2009/12/08/qsort-segfault/</link>
		<comments>http://blogs.gnome.org/jjongsma/2009/12/08/qsort-segfault/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 03:49:34 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[gtkmm]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/?p=79</guid>
		<description><![CDATA[Working on a personal itch-scratching project, I found myself wanting a sortable treeview. So I stuffed my treemodel into a TreeModelSort and set up my sort functions, and everything was happy. Except, when running my application, I kept getting strange segfaults within glib&#8217;s qsort implementation. I had set the following function as my sort_func (yes, [...]]]></description>
			<content:encoded><![CDATA[<p>Working on a personal itch-scratching project, I found myself wanting a sortable treeview.  So I stuffed my treemodel into a TreeModelSort and set up my sort functions, and everything was happy.  Except, when running my application, I kept getting strange segfaults within glib&#8217;s qsort implementation.  I had set the following function as my sort_func (yes, it&#8217;s C++, but it should be fairly self-explanatory):</p>
<pre><code>static int
compare_foo (const Gtk::TreeModel::iterator&#038; a, const Gtk::TreeModel::iterator&#038; b)
{
    std::tr1::shared_ptr&lt;Foo&gt; l1, l2;
    l1 = a-&gt;get_value (COLUMN_FOO);
    l2 = b-&gt;get_value (COLUMN_FOO);

    if (!l1)
        return -1;

    if (!l2)
        return 1;

    return l1-&gt;get_id () - l2-&gt;get_id ();
}</code></pre>
<p>Can you spot the error?  Running it under valgrind indicated that I was reading data from *before* the start of the array that was being sorted.  In fact, the following lines of code in g_qsort_with_data() were causing tmp_ptr to be decreased back past the start of the array:</p>
<pre><code>        while ((*compare_func) ((void *) run_ptr, (void *) tmp_ptr, user_data) &lt; 0)
          tmp_ptr -= size;</code></pre>
<p>Hmm.  Why is there no guard to prevent tmp_ptr from being decreased past the start?  Then I noticed the following comment up a few lines:</p>
<pre><code>    /* Find smallest element in first threshold and place it at the
       array's beginning.  This is the smallest array element,
       and the operation speeds up insertion sort's inner loop. */</code></pre>
<p>So at this point, the code is assuming that the very first element of the array is the smallest, so compare_func should always return &gt;= 0 when it reaches the start of the array.  Aha!  So the problem is my compare_func.  It turns out I forgot to handle the single case of both values being NULL.</p>
<pre><code>    l1 = a-&gt;get_value (COLUMN_FOO);
    l2 = b-&gt;get_value (COLUMN_FOO);
+
+   if (!l1 &#038;&#038; !l2)
+       return 0;

    if (!l1)
        return -1;</code></pre>
<p>So there&#8217;s not really a big lesson to be learned here, but if you ever hit strange segfaults deep inside glib&#8217;s qsort while sorting a treemodel, do yourself a favor and double-check that your sort function is sane first.  Also, do yourself a favor and run it under valgrind as soon as you get a strange segfault.  Knowing the exact point of the invalid read is infinitely more helpful than waiting until that invalid read causes a segfault.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2009/12/08/qsort-segfault/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>webkitmm</title>
		<link>http://blogs.gnome.org/jjongsma/2008/06/27/webkitmm/</link>
		<comments>http://blogs.gnome.org/jjongsma/2008/06/27/webkitmm/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 23:12:00 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[gtkmm]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[webkit]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/2008/06/27/webkitmm/</guid>
		<description><![CDATA[As a quick follow-on to my last post, I&#8217;ve put a webkitmm git repository up for those that might want to play around with it. It&#8217;s certainly still early, but it is mostly complete. You&#8217;ll probably need a recent checkout WebKit/Gtk+, I&#8217;ve only tested it on trunk. At some point, I&#8217;ll probably import it into [...]]]></description>
			<content:encoded><![CDATA[<p>As a quick follow-on to my last post, I&#8217;ve put a <a href="http://www.gnome.org/~jjongsma/git/webkitmm.git/">webkitmm git repository</a> up for those that might want to play around with it.  It&#8217;s certainly still early, but it is mostly complete.  You&#8217;ll probably need a recent checkout WebKit/Gtk+, I&#8217;ve only tested it on trunk.  At some point, I&#8217;ll probably import it into GNOME subversion, though I really don&#8217;t look forward to that.</p>
<p>There is a very simple browser example in the source tree as well:</p>
<p><a href="http://www.flickr.com/photos/jonner/2617115118/" title="webkitmm by jonner, on Flickr"><img src="http://farm4.static.flickr.com/3078/2617115118_cd2ca0b93f.jpg" alt="webkitmm" height="427" width="500" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2008/06/27/webkitmm/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Fiddling</title>
		<link>http://blogs.gnome.org/jjongsma/2008/03/09/fiddling/</link>
		<comments>http://blogs.gnome.org/jjongsma/2008/03/09/fiddling/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 20:50:06 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[Agave]]></category>
		<category><![CDATA[GNOME]]></category>
		<category><![CDATA[gtkmm]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/2008/03/09/fiddling/</guid>
		<description><![CDATA[A belated happy first birthday to my beautiful daughter. It&#8217;s been a fantastic year. Since then it seems like I&#8217;ve been sick most of the time. Instead of doing something useful, I&#8217;ve taken to fidding on a re-write of my Agave colorscheme designer, and I&#8217;ve made a decent amount of progress. It still lacks a [...]]]></description>
			<content:encoded><![CDATA[<p>A belated happy first birthday to my beautiful daughter.  It&#8217;s been a fantastic year.</p>
<p><a href="http://www.flickr.com/photos/jonner/2311820822/" title="DSC_5570 by jonner, on Flickr"><img src="http://farm3.static.flickr.com/2007/2311820822_2e9e68bfbc_m.jpg" alt="DSC_5570" height="160" width="240" /></a></p>
<p>Since then it seems like I&#8217;ve been sick most of the time.  Instead of doing something useful, I&#8217;ve taken to fidding on a re-write of my Agave colorscheme designer, and I&#8217;ve made a decent amount of progress.  It still lacks a lot of features of the original, but it benefits from my vastly better grasp of gtkmm and related technologies.  I still don&#8217;t know if I&#8217;ll ever actually get around to releasing it. It&#8217;s currently serving as a way for me to relax and take breaks from my other projects.  It&#8217;s become sort of a playground for me to try out new technologies, and I think I&#8217;ve succeeded in making it nearly impossible for normal users to build as it requires quite a few very new or unreleased libraries (goocanvasmm, giomm, glibmm-utils, etc).</p>
<p>Here&#8217;s a little screencast of what I&#8217;ve done so far:</p>
<p><a href="http://www.gnome.org/~jjongsma/temp/agave2.ogg"><img src="http://www.gnome.org/~jjongsma/temp/Agave2-video-thumbnail.png" alt="video thumbnail" height="200" width="188" /></a></p>
<p>I&#8217;ve set up a <a href="http://github.com/jonner/agave2/tree/master">repository on github</a> for anybody that&#8217;s interested in playing around with it.</p>
<p>Also, I&#8217;ll be <a href="http://mail.gnome.org/archives/gtkmm-list/2008-March/msg00037.html">taking over some glibmm maintainer duties</a> from murray after the 2.16.0 release.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2008/03/09/fiddling/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Releases galore</title>
		<link>http://blogs.gnome.org/jjongsma/2006/08/22/releases-galore/</link>
		<comments>http://blogs.gnome.org/jjongsma/2006/08/22/releases-galore/#comments</comments>
		<pubDate>Tue, 22 Aug 2006 03:50:00 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[cairomm]]></category>
		<category><![CDATA[gtkmm]]></category>
		<category><![CDATA[Life]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/2006/08/22/releases-galore/</guid>
		<description><![CDATA[It feels like I&#8217;ve been making software releases like crazy lately. I guess people who&#8217;ve been involved in GNOME for a while probably feel this way regularly when release time comes around, but it&#8217;s sort of a first for me. cairomm I&#8217;ve been hacking on cairomm and gtkmm for quite a while now, but cairomm [...]]]></description>
			<content:encoded><![CDATA[<p> It feels like I&#8217;ve been making software releases like crazy lately.  I guess people who&#8217;ve been involved in GNOME for a while probably feel this way regularly when release time comes around, but it&#8217;s sort of a first for me.</p>
<h3>cairomm</h3>
<p>I&#8217;ve been hacking on cairomm and gtkmm for quite a while now, but cairomm has up to now been in a development state.  For the gtkmm 2.10 release, we needed to depend on cairomm, so it had to be declared stable.  So that happened over the weekend with version 1.2.0, followed on quickly by a 1.2.1 release to fix a small Windows compilation issue.</p>
<h3>gtkmm</h3>
<p>There was a slightly nasty gtkmm bug that popped up just after Murray released version 2.10.0 and went on vacation, so I had to try to get a new release cut in time for the GNOME release cutoff today.  I&#8217;ve been developing my own <a href="http://home.gna.org/colorscheme/">Agave</a> application for a while, but this is really the first time I&#8217;ve had to release software that A) matters, and B) needs to get done on a tight schedule.  All in all a little nerve-wracking, but exhilarating at the same time.</p>
<h3>Summer of Code</h3>
<p>It&#8217;s great to see a updates on lot of the great summer of code projects within GNOME.  It seems like this year was a really great year for SoC projects within GNOME.  Great job to all the participants.</p>
<h3>Life</h3>
<p>This weekend I actually got some excercise.  Sunday Joanne and I decided to go to the park across the street and play a little bit of tennis.  I&#8217;ve never really played much tennis in my life, but I&#8217;ve decided that I really like it.  I even went and bought some new tennis balls since the ones we had in the house were all old and flat and barely bounced.  Maybe I&#8217;ve finally found the thing to get me off my ass and get some excercise every now and then.</p>
<p>Update: for those who don&#8217;t have any idea who I am, I wrote a little <a href="http://jongsmamm.blogspot.com/2006/08/hello-planet-gnome.html">introductory post</a> that didn&#8217;t seem to get picked up by planet GNOME when I posted it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2006/08/22/releases-galore/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>gtkmm Website Update</title>
		<link>http://blogs.gnome.org/jjongsma/2006/07/13/gtkmm-website-update/</link>
		<comments>http://blogs.gnome.org/jjongsma/2006/07/13/gtkmm-website-update/#comments</comments>
		<pubDate>Thu, 13 Jul 2006 13:55:00 +0000</pubDate>
		<dc:creator>jonner</dc:creator>
				<category><![CDATA[GNOME]]></category>
		<category><![CDATA[gtkmm]]></category>

		<guid isPermaLink="false">http://blogs.gnome.org/jjongsma/2006/07/13/gtkmm-website-update/</guid>
		<description><![CDATA[For those that haven&#8217;t noticed, the gtkmm website has been updated recently. I tried to keep the markup more or less the same and do most of the changes with a stylesheet. I ended up needing to change the structure slightly, but for the most part, I could do most things with css, which was [...]]]></description>
			<content:encoded><![CDATA[<p> For those that haven&#8217;t noticed, the <a href="http://gtkmm.org/">gtkmm website</a> has been updated recently.  I tried to keep the markup more or less the same and do most of the changes with a stylesheet.  I ended up needing to change the structure slightly, but for the most part, I could do most things with css, which was nice.</p>
<p>I&#8217;d really like it if the main website and the documentation (API and tutorial) all shared the same basic page structure and stylesheet, but there are a few complications.  For instance, the main website source is located in the <a href="http://cvs.gnome.org/viewcvs/gnomemm-website/">gnomemm-website</a> cvs module, whereas the gtkmm API and turorial is located in the gtkmm module, and sharing files between cvs modules is difficult (impossible?).  In addition, the main website source is static html, the API is generated by doxygen, and the tutorial is generated by docbook stylesheets.  Getting all of these to generate the same general structure is probably possible, but again would require a shared html header and footer template between the two cvs modules.</p>
<p>So there are some issues that I&#8217;d really like to resolve, but I think it&#8217;s already a big improvement over the old site, so further improvements are on the backburner for now while I work on some actual code.  If you have any comments or suggestions, feel free to send them to <a href="http://mail.gnome.org/mailman/listinfo/gtkmm-list">gtkmm-list</a>.</p>
<p>I&#8217;ve also updated the information on the <a href="http://cairographics.org/cairomm">cairomm page</a> significantly, which was previously very sparse.  It could still use some more love, but at least it shouldn&#8217;t be much of a barrier to involvement in cairomm anymore.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.gnome.org/jjongsma/2006/07/13/gtkmm-website-update/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blogs.gnome.org/jjongsma/category/programming/gtkmm/feed/ ) in 0.34041 seconds, on Feb 11th, 2012 at 12:57 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 11th, 2012 at 1:57 pm UTC -->
