Re: Emitting a signal leads to a failed assertion
- From: Ari Jolma <ari jolma tkk fi>
- To: muppet <scott asofyet org>
- Cc: gtk2-perl List <gtk-perl-list gnome org>
- Subject: Re: Emitting a signal leads to a failed assertion
- Date: Sat, 03 Nov 2007 11:26:56 +0200
muppet kirjoitti:
On Nov 2, 2007, at 9:37 AM, Ari Jolma wrote:
GLib-GObject-CRITICAL **: g_object_notify: assertion `G_IS_OBJECT
(object)' failed
(gdb) run myscript --g-fatal-warnings otherargs...
(gdb) backtrace
sadly, the result is "no stack"
However, you don't want to connect directly to the ScrolledWindow's
scrollbar, anyway. The scrollbars are combination
view-and-controllers. The horizontal and vertical adjustments are
what you actually want. ScrolledWindow communicates with the scrollee
through the adjustments; you can programatically control the scrolling
with the adjustments; etc, etc, etc.
How do I then react to the user scrolling? I tried connecting at least
scroll-event and scroll-child signals to the scrolled window, to the
image, to the event box the image is in, but those don't fire the
callback when the user simply scrolls with the mouse.
I realized that the heart of the problem is here. In the render method,
I redraw the image and set the adjustments. For some reason I seem to be
unable to do it simply:
$self->set_vadjustment(...)
instead I have to (can't make it work other way):
$self->{old_hadj} = $self->get_hscrollbar->get_adjustment; # prevents a
warning
$self->get_hscrollbar->set_adjustment(...)
i.e. I have to store a reference to the adjustment, otherwise I get
critical error as above. The critical error is 'GTK_IS_ADJUSTMENT
failed', though
Also the critical error I was first reporting does not come from
connecting to the value-changed signal per se, but from calling render
after that. I.e., the process in the application is:
user scrolls the window
the value_changed method is called,
which calls render and then sends an extent-changed signal
the sub the application has connected to extent-changed is called,
which also calls render
the value_changed method exits
the critical error happens
This is also poor design because the, potentially costly, render is
called twice.
Ari
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]