Re: A Gtk2::Bin subclass and a segfault



On Tue, 2007-10-23 at 11:48 +0200, Giuliano wrote:

  I'm  trying to  implement a  custom widget.  A particular  "technique"
(read: ugly trick) I use results in a segfault. If someone could run the
test program and  confirm the behaviour I'd be very  grateful, let alone
take a look  a the sources and  explain me what's going  on... I suspect
the culprit  is gtk+ itself  (2.10.14 here)  and not the  bingindgs, but
well...

I'm seeing the segfault, too.  I think the problem is that removing the
entry from the button triggers focus-out-event.

When the activate signal fires, you call entry_mode_out which tries to
remove the entry from the button.  In processing this removal request,
gtk+ seems to trigger focus-out-event.  This means you call
entry_mode_out again, which tries to remove the entry.  This second
request seems to succeed so that control returns to gtk+.  It tries to
finish the first removal request and that's where the segfault occurs.

  The widget  subclasses Gtk2::Bin, while  I'd have preferred  to
derive
from Gtk2::Container,  and hide/show button/entry as  needed (right
now,
instead i add/remove them on the fly).

I once started implementing support for subclassing Gtk2::Container.
It's pretty much complete and I was able to write, among other things, a
Perl class that's completely equivalent to GtkHBox.

But the approach has one or two fatal problems related to chaining up
method calls and ensuing endless loops.  I haven't been able to solve
these, unfortunately.

-- 
Bye,
-Torsten




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