Hi John, John Obbele <john.obb...@gmail.com> writes:
> Good day everyone ! > > On Sun, Oct 10, 2010 at 12:50:43AM +0800, Andy Stewart wrote: >> >From GObject hierarchy, there are many GObject not derive from >> GInitiallyUnowned. >> >> Please keep patch small and just for one GObject per patch, then we can fix >> if something wrong. > > At least, I've finished musing with the GObjects hierarchy and > its C documentation. To summarize, I've "grep'ed" every > occurrences of the functions "mkFoobar", where "Foobar is the > name of an object not inheriting from GInitiallyUnowned, and fix > the preceding {construct,make}NewGObject according to what I > understand from the C documentation. … hopefully, this should > cover most of (all?) the cases where GObjects are created. > > Patches are not really grouped by objects, but by filenames. The > gio, pango and gtk libraries are affected. > > I've also rewritten the documentation for constructNewGObject to > make it more coherent. > > If I have been too zealous in some part of the code by replacing > traditional *NewObjects calls with "wrapNewGObject", you will > quickly see some horribles glib warnings like the followings and > occasionally some segfaults :) > > (process:###): GLib-GObject-WARNING **: > invalid cast from `(null)' to `Foobar' > (process:###): GLib-GIO-CRITICAL **: > g_foo_bar_method: assertion `G_IS_FOO_BAR (foobar)' failed > > The good news is that in the opposite case where I forget to use > "wrapNewGObject", you will not see any problems ,) > > Please test the modifications on real programs (if possible using > pango and gio) and keep me informed if you see any strange > things. I have test your patches, looks good except change for mkTextMark. After apply 'wrapNewGObject mkTextMark', I got error : ------------------------------> textMark error start <------------------------------ (manatee:22540): Gtk-WARNING **: GtkTextMark being finalized while still in the buffer; someone removed a reference they didn't own! Crash impending (manatee:22540): Gtk-WARNING **: GtkTextMark being finalized while still in the buffer; someone removed a reference they didn't own! Crash impending (manatee:22540): Gtk-WARNING **: GtkTextMark being finalized while still in the buffer; someone removed a reference they didn't own! Crash impending (manatee:22540): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed ------------------------------> textMark error end <------------------------------ Looks wrapNewGObject finalized TextMark too early to crash program. I have push new patch revert the change for mkTextMark, please check repository. BTW, i search regexp "\(make\|construct\)NewGObject\s-mk[a-zA-Z]+" in Emacs, and found many results (146) should use wrapNewGObject too, something like: widgetRenderIcon :: WidgetClass self => self -> String -- ^ @stockId@ - a stock ID -> IconSize -- ^ @size@ - a stock size -> String -- ^ @detail@ - render detail to pass to theme engine -> IO (Maybe Pixbuf) -- ^ returns a new pixbuf, or @Nothing@ if the stock ID -- wasn't known widgetRenderIcon self stockId size detail = maybeNull (makeNewGObject mkPixbuf) $ missing? ;p As far test with my program (http://goo.gl/MkVw), works well, but my program code can't cover all your changed, so we need more test before release gtk2hs-0.12.0, i will post mail in gtk2hs-user and haskell-cafe later. Axel, can you modified gtk2hs-buildtools make it generate wrapNewGObject if GObject is not derive from GInitiallyUnowned? Thanks! :) > P.S.: I've attached an additional patch for > gio/demo/FileManager.hs which did not compile on my machine. Sorry, i forgot update demo code after i change GIO APIs. BTW, we should use fromString/toString in package 'utf8-string' to convert between ByteString and UTF8 String safety. I have push new patch to fix this problem, thanks report! Cheers, -- Andy ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Gtk2hs-devel mailing list Gtk2hs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel