John,

thanks very much for your contribution. Fixing things on this scale  
can quickly become a time sink, so your semi-automatic contribution is  
very welcome and saves us a lot of times.

Sometimes, there is no way around reading the documentation of Gtk+,  
that's why we don't create Gtk2Hs fully automatically.

Cheers,
Axel

On Oct 21, 2010, at 21:06, John Obbele wrote:

> Hi,
>
> On Fri, Oct 22, 2010 at 01:41:11AM +0800, Andy Stewart wrote:
>> 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    
>> <------------------------------
>
> My bad. I think the error is not with TextMark.textMarkNew but
> only within Graphics/UI/Gtk/Multiline/TextBuffer.textBufferNew
> where I effectively put a "wrapNewGObject" whereas the C
> documentation warns against it (cf "transfer NONE" in [0]).
>
> [0]: 
> http://library.gnome.org/devel/gtk/unstable/GtkTextBuffer.html#gtk-text-buffer-create-mark
>
> I have read the documentation too fast thinking
> "cfunction_foo_create ()" == "cfunction_foo_new ()" => new
> object. I was wrong.
>
> Hopefully, the other modifications avoid this semantic trap.
>
>> 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
>
> Yeah missing :(
>
> My haskell/parsec3 skills failed in this case (damned trailing
> parenthesis ')' !). Guess I will have to fix it and recheck some
> code.
>
>
> Keep in mind that one should check the C documentation for every
> occurrence of {construct,make}NewGObject. Typically, only
> functions with names like `prefix_objectName_new` (e.g.
> "gtk_text_mark_new") requires "wrapNewGObject". Functions
> following the `prefix_objectName_get` pattern (e.g.
> "gtk_cursor_get_display") should use "makeNewGObject" since there
> is not transfer of ownership with them.
>
> Gtk developers provide help by explicitly stating if
> the transfer type is "NONE" (=> "makeNewGObject"), "CONTAINER"
> (?=> free the returned list/array BUT use "makeNewGObject" on
> every item) or "FULL" (=> "wrapNewGObject").
>
> Unfortunately, this help is not present for every function
> (especially in my local version of the gtk-doc). So I assume the
> only solution to this problem is to rely on error prone human
> reading.
>
> ... or we could also build an overmind using a full Haskell/C2HS
> lexer/parser coupled with GInstropection to solve this issue. But
> man, I'm really too lazy to implement this right now.
>
>
> So to conclude, sorry for my mistake on TextMarker. Let me
> rethink something about missing "constructNewGObject"
> declarations ,)
>
> regards,
> /John
>
> ------------------------------------------------------------------------------
> 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


------------------------------------------------------------------------------
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

Reply via email to