GNOME Bugzilla – Bug 671687
Cannot use cairo context from GtkDrawingArea::draw signal
Last modified: 2012-05-25 20:38:13 UTC
let w = new Gtk.Window(); let da = new Gtk.DrawingArea(); da.connect('draw', function(d, cr) { cr.fill(); }); w.add(da); w.show_all(); Spits out an error. Fix that.
Created attachment 209287 [details] [review] foreign: Remove type_info from foreign APIs If we don't require a type_info in a foreign API, this will make it easier to use the foreign API from another place in the code. Swap out the use of type_info with the interface info that the type info contains.
Created attachment 209288 [details] [review] value: Handle foreign types correctly when converting from a GValue
Giovanni, Colin: can somebody review this?
Review of attachment 209287 [details] [review]: Better late than never, they say... Anyway, this definitely makes sense. (a-c_n is not a statement of committability, check Colin for freezes :) )
Review of attachment 209288 [details] [review]: ::: gi/value.c @@ +682,3 @@ + GIArgument arg; + arg.v_pointer = gboxed; + return gjs_struct_foreign_convert_from_g_argument(context, value_p, info, &arg); Don't you need to free info here (and in the non foreign path too)?
Created attachment 211690 [details] [review] value: Fix memory leak when constructing a GValue from a Boxed Nice catch.
Created attachment 211691 [details] [review] value: Handle foreign types correctly when converting from a GValue
Ping?
Review of attachment 211690 [details] [review]: ::: gi/value.c @@ +695,3 @@ } *value_p = OBJECT_TO_JSVAL(obj); + g_base_info_unref(info); We leak in the error path above too...but I guess that one's not a big deal.
Review of attachment 211691 [details] [review]: Can we have a test case for this one? Otherwise looks OK.
Created attachment 214996 [details] [review] tests: Fix warnings
Created attachment 214997 [details] [review] tests: Add a foreign struct signal test
Created attachment 214998 [details] [review] value: Fix memory leak when constructing a GValue from a Boxed Added test.
Created attachment 214999 [details] [review] tests: Fix a memory leak We need to unref the cairo surface here, as we are making the context be the sole owner of it.
Review of attachment 214996 [details] [review]: OK
Review of attachment 214997 [details] [review]: ::: configure.ac @@ +133,3 @@ AC_ARG_ENABLE(tests,[ --disable-tests disable test libraries ], enable_tests=$enableval,enable_tests=yes) have_cairo=no +PKG_CHECK_MODULES(CAIRO, [cairo cairo-gobject], have_cairo=yes, have_cairo=no) Totally minor: cairo-gobject requires cairo, so listing the latter is redundant.
Review of attachment 214998 [details] [review]: Yep.
Review of attachment 214999 [details] [review]: Yep.
Attachment 214996 [details] pushed as fed7b25 - tests: Fix warnings Attachment 214997 [details] pushed as a7bfba3 - tests: Add a foreign struct signal test Attachment 214999 [details] pushed as 9d9000c - tests: Fix a memory leak
Attachment 209287 [details] pushed as b7ffb73 - foreign: Remove type_info from foreign APIs Attachment 211691 [details] pushed as 085fb4d - value: Handle foreign types correctly when converting from a GValue Attachment 214998 [details] pushed as e0a9fb9 - value: Fix memory leak when constructing a GValue from a Boxed