Glib::wrap with copy=true semantics?


I have a scenario here where there is a GtkAdjustment owned by
a C gtk widget and a Gtkmm gets the adjustment and then wraps it
in a Gtkmm wrapper. The wrapper should pass copy=true because it
isn't the owner of the underlying GtkObject. However, what I
observe is that the wrapper is created and it increments the
adjustment's refcount as expected but when the wrapper dies, it
does not decrement the refcount, and it calls gtk_object_destroy
which seems incorrect. Because the other ref holders aren't
expecting destroy to be called, they do not release their refs
and the object ends up being leaked when the other ref olders
do release their refs because there is still a +1 thanks to
the wrapper.

On the other hand, if I pass copy=false, it doesn't touch the
refcount at all and calls gtk_object_destroy when the wrapper
dies as you'd expect.

Is there a bug here or am I just expecting the wrong semantics?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]