<< September 18, 2007 >>
it's like a mind-meld
<boc> what's the word for a word that used to mean something
<boc> but now doesn't, because people have abused it?
<shaver> "innovation"
<boc> well, yes
<boc> that is in fact the word i am going to write about
so, yesterday we had to get up before the garbagemen came by for
some meeting. the cto and some other guys from
"corporate" would be in, so i figured it was some big
thing, like maybe they were closing the office, or that maybe we
were giving our other water cooler to the microsoft team.
i don't really remember what was discussed in the meeting, because
it was so early, but there was another meeting in the afternoon,
where jaffe was talking about how the cambridge office is the center
of innovation at novell, and provided the
moonlight effort as an example.
even with skipping the political issues involved, this project may
be fun and interesting to work on, but implementing someone
else's apis is not innovative.
i feel this is pretty self-evident, so i'll just leave it at that,
and remind you that kevin's
album is out today.
<< September 18, 2007 >>
shaver will mock me for my ignorance
today gdb basically fixed a tough
bug for me, and i figured i'd write down how so i don't forget.
so the bug is that monodevelop is crashing with a certain theme;
however, there are some hints before the crash that something
possibly related was going on:
(MonoDevelop:4539): Gtk-CRITICAL **: gtk_style_detach: assertion `style->attach_count > 0' failed
(MonoDevelop:4539): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed
this sure looks like a ref counting bug, which i at first balked at
finding on my own. after a couple of days of trying to get enough
disk for chronomancer (it
required 88G in the end), i couldn't get it to tell me when
gtk_style_attach and gtk_style_detach were being
called.
next up would be dtrace, but this is linux, so...
after a little googling, i figured out how to get gdb to run some
commands on breakpoints. here is what i ended up using:
(gdb) define awesome
Type commands for definition of "awesome".
End with a line saying just "end".
>if style == 0x8749808
>f 1
>p (char *)g_type_name_from_instance (widget)
>end
>end
(gdb) b gtk_style_attach
Breakpoint 1 at 0xb222fdf: file gtkstyle.c, line 700
(gdb) commands
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just "end".
>awesome
>cont
>end
(gdb) b gtk_style_detach
Breakpoint 2 at 0x622323c: file gtkstyle.c, line 782
(gdb) commands
Type commands for when breakpoint 2 is hit, one per line.
End with a line saying just "end".
>awesome
>cont
>end
i found that the specific style i was interested in was always at
the same address, so i could cut down on a lot of the output from
gdb. also, there was never any theme code in any of these stack
traces, so i was beginning to suspect that the initial blame may be
misguided. anyway, what was printed is a bunch of stuff like this:
Breakpoint 2, 0xb623b23c in IA__gtk_style_detach (style=0x8749808) at gtkstyle.c:782
#1 0xb63298d2 in gtk_widget_real_unrealize (widget=0x8e76170) at gtkwidget.c:8004
$864 = 0x8e82740 "__gtksharp_26_Gdl_DockNotebook"
so, what this gives me is a list of widget classes that call detach,
and those that call attach, and a simple comparison of the two
showed that there were two classes that called detach but not
attach: __gtksharp_25_Gdl_DockPaned and
__gtksharp_26_Gdl_DockNotebook. time to go look at the code.
turns out, both Gdl.DockPaned and Gdl.DockNotebook are both
subclasses of Gdl.DockItem. i'm sure you can already guess what was
in its OnRealize function:
// I don't know why the following line is needed, but it makes MD crash when
// the gtk theme changes (e.g. when changing to Glider). It seems to work ok without it.
// Style = Style.Attach (GdkWindow);
well, turns out, it does not work ok without it. a quick patch to
uncomment this line, and MonoDevelop starts up. i was unable to
reproduce the crash mentioned in that comment.
so, gdb comes through for once. oh, and by the way, you will want
to rebuild your gtk with -O0 before trying any of this. otherwise,
don't even
load it up.