Re: Gtk2::Notebook and switch-page signal [solved]



On Thu, 2011-01-27 at 14:43 +0100, Kiss Gabor (Bitman) wrote:
Signal handler runs well (if defined at all) but after this program dies
with segfault.

If I connect to the 'switch-page' signal and print out the passed values
I get something like this:

arg1: Gtk2::Notebook=HASH(0x8f165a0)
arg2: 150233744
arg3: 0

arg1: Gtk2::Notebook=HASH(0x8f165a0)
arg2: 150233800
arg3: 1

The first value is the notebook object ref and the third value is the
page index. The second value that you ask about is (I believe) a pointer
to the memory location of the internal GtkNotebookPage implementation.
So, while the signal_emit function might accept any integer as a valid
value, it is (almost certainly) not be a valid memory location and so
results in a segfault.

If I first capture the pointer value for the page within the signal
handler and then use it in the signal_emit function, it works fine, but
this is a rather convoluted way to go about things.


Inspection of "core" file shows, that this seems to be a libgtk bug.


I don't know if this would be considered a bug per se, but it does beg
the question of why this value is included in an external implementation
at all. As far as I can tell, there is no way to access it other than by
connecting to the 'switch-page' signal, and no need to use it unless you
want to emit the signal yourself.

Hope this helps,
Jeremy






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