Re: the latest cellrenderer scoop



muppet wrote:

i just put Gtk2::CellRenderer::Base 0.04 on my website,
http://asofyet.org/muppet/software/gtk2-perl/Gtk2-CellRenderer-Base- 0.04.tar.gz

this version simplifies things rather a lot. The Gtk2::CellRenderer::Base class no longer actually exists. You do a normal Glib::Object::Subclass of Gtk2::CellRenderer or any of its derivatives, and then call __PACKAGE__->_install_overrides; this installs into the GObjectClass structure the perl marshallers which look for the on_get_size, on_render, on_activate, and on_start_editing subs.

you can call the parent from within your child subs by doing parent_foo instead of on_foo, like this:

  sub on_get_size {  shift->parent_get_size (@_)  }

that uses caller() to find the calling context, so it can find the parent of that package. (this hack is necessary because GObjects always show up as the bottom of the hierarchy.)


my only complaint about this version is the new syntax is ugly:

  use Glib::Object::Subclass ......;
  __PACKAGE__->_install_overrides;

it would be possible to create another pragma-like module to wrap that up for us, a la Glib::Object::Subclass, but i hesitate to do this because it most likely would entail duplicating Subclass.pm.

on the plus side, this is all self-contained -- everything is implemented in Base.xs, and could easily be dropped into Gtk2/xs/GtkCellRenderer.xs without any problems.


whatchoo think?

muppet,

I'm not sure why, but I've got some problems here. "example.pl" dumps core on me. It happens whenever I click on the drop-down list to start editing it. Is it supposed to do this? I noticed it was slightly changed from 0.03, so I have assumed that it was re-written for the new stuff in 0.04?

I never got around to trying out version 0.03 before 0.04. Also, comparing the patches released with version 0.03 to the changes in 0.04, I thought (and still do) that the Glib-patch was no longer necessary. So I patched up the Gtk2 library and installed it. The patches seem innocent enough that I didn't bother with setting up a parallel installation for testing.

"example.pl" dumped core.

Next step was to install the Glib patch as well. I could have been wrong about it's importance. No difference, still a core dump.

I then went back to version 0.03, and this one didn't core dump. So it's something introduced in 0.04.

"fancy.pl" does not *not* throw a segmentation violation.

That's where I am so far. I might continue digging, but that's probably a waste of time until you can give me a hint at which direction you want me to go.

I'm sorry I don't have my environment/installation set up to do proper C-level debugging. I actually think I haven't started up "gdb" in years, I was rather surprised at myself that I still remembered how to get a back-trace from a core. So rather basic information, I'm afraid. This is from 0.04 *after* installing the glib-patch:

(gdb) bt
#0  0x4083fec8 in gtk2perl_cell_renderer_start_editing ()
from /usr/lib/perl5/site_perl/5.8.0/i686-linux/auto/Gtk2/CellRenderer/Base/Base.so #1 0x40526746 in gtk_cell_renderer_start_editing () from /usr/lib/libgtk-x11-2.0.so.0 #2 0x4069a308 in gtk_tree_view_column_cell_process_action () from /usr/lib/libgtk-x11-2.0.so.0 #3 0x406982bf in _gtk_tree_view_column_cell_event () from /usr/lib/libgtk-x11-2.0.so.0 #4 0x40681dd5 in gtk_tree_view_button_press () from /usr/lib/libgtk-x11-2.0.so.0 #5 0x405b411f in _gtk_marshal_BOOLEAN__BOXED () from /usr/lib/libgtk-x11-2.0.so.0 #6 0x40245477 in g_type_class_meta_marshal () from /usr/lib/libgobject-2.0.so.0
#7  0x40244e18 in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0
#8 0x40256e79 in signal_emit_unlocked_R () from /usr/lib/libgobject-2.0.so.0
#9  0x40256111 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0
#10 0x40256634 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0
#11 0x406a6580 in gtk_widget_event_internal () from /usr/lib/libgtk-x11-2.0.so.0
#12 0x405b3506 in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0
#13 0x405b25e6 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0
#14 0x4077fd73 in gdk_event_dispatch () from /usr/lib/libgdk-x11-2.0.so.0
#15 0x402974d0 in g_main_dispatch () from /usr/lib/libglib-2.0.so.0
#16 0x40295912 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#17 0x40297988 in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#18 0x40295ee2 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
#19 0x405b205f in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
#20 0x4033bb6e in XS_Gtk2_main () from /usr/lib/perl5/site_perl/5.8.0/i686-linux/auto/Gtk2/Gtk2.so
#21 0x080c041e in Perl_pp_entersub ()
#22 0x080ba489 in Perl_runops_standard ()
#23 0x08062674 in S_run_body ()
#24 0x0806243d in perl_run ()
#25 0x0805effc in main ()
#26 0x400c4be7 in __libc_start_main () from /lib/libc.so.6

Bjarne




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