Re: segfault using extension events in Gtk2's scribble.pl



gvb <postdoc38 yahoo fr>:
Here is a C code that enables the extended devices (then fires up the
InputDialog to check they are enabled):

initialize_input_devices.c
<http://gtk.10911.n7.nabble.com/file/n85894/initialize_input_devices.c>  

I tried translating it like this

my $display=$window->get_display;
my @list=($display->list_devices());
for(my $i=0;$i<$#list;$i++){
  my $name=$list[$i]->name;
  my $result=$list[$i]->set_mode('GDK_MODE_SCREEN');
  print "activating device \# $i, name=$name result=$result\n";
}

but I guess I am missing the equivalent of the "tmp_list->data". Any idea?

The Perl code does seem to be equivalent to the C code.  In the C code "tmp_list->data" is the i-th GdkDevice 
object, i.e., $list[$i] in your Perl code.

What's not working with the Perl version?  Do you still get a segfault?  If so, try to get a backtrace with 
gdb:

  $ gdb --args perl program.pl
  (gdb) r
  ...
  [Segfault]
  (gdb) bt

If the backtrace doesn't seem to make sense, try to use valgrind's memcheck:

  $ valgrind perl program.pl


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