Re: GooCanvas Reference Counting woes.
- From: "Paul Davis" <pjdavis engineering uiowa edu>
- To: "GTKmm List" <gtkmm-list gnome org>
- Subject: Re: GooCanvas Reference Counting woes.
- Date: Sun, 1 Oct 2006 19:46:27 -0500
This just in... I'm a moron.
Changing the _CONVERSION macro's fixed the problem. All that was required was to link against the right version of the library.
On 10/1/06, Paul Davis <pjdavis engineering uiowa edu> wrote:
I'm going through trying to finish these wrappers for GooCanvas and I'm having a heck of a time trying to get reference counting done correctly.
The most obvious case to point out is in the signal handlers.
From the reading I've been doing, it appears that when the signal is called, the Glib::RefPtr is done using ::wrap() which doesn't appear to increment the reference count. But then at the end of the signal handler, when the RefPtr goes out of scope, the reference count is decremented, thus causing the object to be deleted.
The signal handler method looks like this:
SimpleWindow::on_rect_button_press( const Glib::RefPtr<GooCanvas::ItemView>& item, GdkEventButton* event )
std::cout << "You clicked the rectangle!" << std::endl ;
return true ;
By calling item->reference(), all problems are solved.
I tried changing the convert m4 macro to this:
So that the reference count would be updated, but it doesn't seem to affect anything.
Anyway, the current version in SVN has all this if anyone would like to take a look.
] [Thread Prev