Gtk2::SimpleList crashes

View: New views
9 Messages — Rating Filter:   Alert me  

Gtk2::SimpleList crashes

by Peter Daum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Originally, I tried to find a way to delete all values matching certain criteria
from a Gtk2::SimpleList (which always crashed). Eventually, I found, that I don't
have to get fancy to cause that crash - the following will do it:

     my @data=@{$slist->{data}};
     @{$slist->{data}}=@data;

Gtk-CRITICAL **: gtk_list_store_get_value: assertion `VALID_ITER (iter, list_store)' failed at
/usr/lib/perl5/Gtk2/SimpleList.pm line 248, <F> line 35.
GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL' failed at
/usr/lib/perl5/Gtk2/SimpleList.pm line 248, <F> line 35.
Segmentation fault

Can anybody tell me what's wrong with that code snippet?
Is there any workaround?

Regards,
                             Peter


_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Gtk2::SimpleList crashes

by muppet-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Aug 15, 2009, at 3:24 PM, Peter Daum wrote:

> Originally, I tried to find a way to delete all values matching  
> certain criteria
> from a Gtk2::SimpleList (which always crashed). Eventually, I found,  
> that I don't
> have to get fancy to cause that crash - the following will do it:
>
>    my @data=@{$slist->{data}};
>    @{$slist->{data}}=@data;
>
> Gtk-CRITICAL **: gtk_list_store_get_value: assertion `VALID_ITER  
> (iter, list_store)' failed at /usr/lib/perl5/Gtk2/SimpleList.pm line  
> 248, <F> line 35.
> GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table !=  
> NULL' failed at /usr/lib/perl5/Gtk2/SimpleList.pm line 248, <F> line  
> 35.
> Segmentation fault
>
> Can anybody tell me what's wrong with that code snippet?
> Is there any workaround?

Can you post a script and your software versions?  I can't reproduce  
on my (rather ancient) system with this:

#!/usr/bin/perl -w

use strict;
use Gtk2 -init;
use Gtk2::SimpleList;

my $slist = Gtk2::SimpleList->new ('Stuff' => 'text');

@{ $slist->{data} } = qw(one two three four five six seven);

my @data = @{ $slist->{data} };
@{ $slist->{data} } = @data;


print "Gtk2::VERSION              $Gtk2::VERSION\n";
print "Gtk2::SimpleList::VERSION  $Gtk2::SimpleList::VERSION\n";
print "Gtk2->GET_VERSION_INFO     ".join(".",Gtk2-
 >GET_VERSION_INFO)."\n";
print "Gtk2->get_version_info     ".join(".",Gtk2-
 >get_version_info)."\n";

----------------------------------

Gtk2::VERSION              1.080
Gtk2::SimpleList::VERSION  0.15
Gtk2->GET_VERSION_INFO     2.4.0
Gtk2->get_version_info     2.4.14



--
Y: That's funny!
Z: (silent)
Y: That's not funny.
Z: (silent)
Y: Is that funny?
Z: (nods)
Y: Then why didn't you laugh?
Z: Sometimes, whenever it's funny, I don't laugh.  But sometimes, I do.
Y: When is it funny?
Z: Whenever you say "poop" and "fart" and "pee" and "butt," I laugh.
Y: Oh, okay.

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Gtk2::SimpleList crashes

by kobi_tk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Peter Daum pisze:

> Originally, I tried to find a way to delete all values matching
> certain criteria
> from a Gtk2::SimpleList (which always crashed). Eventually, I found,
> that I don't
> have to get fancy to cause that crash - the following will do it:
>
> my @data=@{$slist->{data}};
> @{$slist->{data}}=@data;
>
> Gtk-CRITICAL **: gtk_list_store_get_value: assertion `VALID_ITER
> (iter, list_store)' failed at /usr/lib/perl5/Gtk2/SimpleList.pm line
> 248, <F> line 35.
> GLib-CRITICAL **: g_hash_table_lookup: assertion `hash_table != NULL'
> failed at /usr/lib/perl5/Gtk2/SimpleList.pm line 248, <F> line 35.
> Segmentation fault
>
> Can anybody tell me what's wrong with that code snippet?
> Is there any workaround?
>
> Regards,
> Peter
>
>
> _______________________________________________
> gtk-perl-list mailing list
> gtk-perl-list@...
> http://mail.gnome.org/mailman/listinfo/gtk-perl-list
>
Hi.
I had similar crash. I think you are using signal connect
"row_activated" and example code from this mailing list.
In this code there is a var declaration
$row_ref = $slist>get_row_data_from_path($pth);
and later there is reference $$row_ref[n].
Using $$row_ref and deleting whole data from list or only certain data
cause script to crash.
If you put $$row-ref(n) into normal variable crash won't happen.
I only guess. Without more of your code nobody can help you here.

Regards Kobi.



----------------------------------------------------------------------
Odstraszacz Komarow!
Sciagnij >> http://link.interia.pl/f22d4 


_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Gtk2::SimpleList crashes

by Peter Daum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


muppet wrote:

> Can you post a script and your software versions?  I can't reproduce on
> my (rather ancient) system with this:

... I had to slightly rearrange your script so it can produce some output:
(with your script, there is no error message, just the segfault)

use Gtk2 -init;
use Gtk2::SimpleList;
print "Gtk2::VERSION              $Gtk2::VERSION\n";
print "Gtk2::SimpleList::VERSION  $Gtk2::SimpleList::VERSION\n";
print "Gtk2->GET_VERSION_INFO     ".join(".",Gtk2->GET_VERSION_INFO)."\n";
print "Gtk2->get_version_info     ".join(".",Gtk2->get_version_info)."\n";

my $slist = Gtk2::SimpleList->new ('Stuff' => 'text');

@{ $slist->{data} } = qw(one two three four five six seven);

my @data = @{ $slist->{data} };
@{ $slist->{data} } = @data;

Gtk2::VERSION              1.190
Gtk2::SimpleList::VERSION  0.15
Gtk2->GET_VERSION_INFO     2.12.11
Gtk2->get_version_info     2.12.12
Segmentation fault

As far as I can tell this happens in general on Debian "Lenny" (x86 and amd64);
On older systems that I tried, it worked. Obviously, the problem isn't really
in my code but somewhere else.

(In my original program I now, instead of trying to use grep on the list, first
calculate the indices of rows that I need to delete and then use splice;
a little clumsy, but it works ...)

Regards,
                                     Peter




_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Gtk2::SimpleList crashes

by Emmanuel Rodriguez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Sun, Aug 16, 2009 at 9:14 PM, Peter Daum <gator_ml@...> wrote:

muppet wrote:

Can you post a script and your software versions?  I can't reproduce on my (rather ancient) system with this:

... I had to slightly rearrange your script so it can produce some output:
(with your script, there is no error message, just the segfault)


use Gtk2 -init;
use Gtk2::SimpleList;
print "Gtk2::VERSION              $Gtk2::VERSION\n";
print "Gtk2::SimpleList::VERSION  $Gtk2::SimpleList::VERSION\n";
print "Gtk2->GET_VERSION_INFO     ".join(".",Gtk2->GET_VERSION_INFO)."\n";
print "Gtk2->get_version_info     ".join(".",Gtk2->get_version_info)."\n";

my $slist = Gtk2::SimpleList->new ('Stuff' => 'text');

@{ $slist->{data} } = qw(one two three four five six seven);

my @data = @{ $slist->{data} };
@{ $slist->{data} } = @data;

Gtk2::VERSION              1.190

Gtk2::SimpleList::VERSION  0.15
Gtk2->GET_VERSION_INFO     2.12.11
Gtk2->get_version_info     2.12.12
Segmentation fault

As far as I can tell this happens in general on Debian "Lenny" (x86 and amd64);
On older systems that I tried, it worked. Obviously, the problem isn't really
in my code but somewhere else.

This reminds me of this thread http://www.mail-archive.com/gtk-perl-list@.../msg05608.html where  Gtk2::Ex::Simple::List would crash in perl 5.10 (Debian Lenny) but not in perl 5.8. What I also remember was that running the same program through the perl debuger (perl -d script.pl) wouldn't crash but running it normally (perl script.pl) would crash it.

--
Emmanuel Rodriguez

_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Gtk2::SimpleList crashes

by Peter Daum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Emmanuel Rodriguez wrote:
> This reminds me of this thread
> http://www.mail-archive.com/gtk-perl-list@.../msg05608.html where  
> Gtk2::Ex::Simple::List would crash in perl 5.10 (Debian Lenny) but not
> in perl 5.8. What I also remember was that running the same program
> through the perl debuger (perl -d script.pl) wouldn't crash but running
> it normally (perl script.pl) would crash it.

Actually, in my case, any array assignment will crash; This is enough:

use Gtk2 -init;
use Gtk2::SimpleList;
my $slist = Gtk2::SimpleList->new ('Stuff' => 'text');
@{ $slist->{data} } = qw(one two three four five six seven);

while the same row by row works:

push @{ $slist->{data} }, $_
   foreach (qw(one two three four five six seven));

The code in the thread that you quoted looks pretty different, but
there is one striking similarity:

When the same code runs under the debugger, it won't crash !

(Now I understand why I had such a hard time debugging my
original code ;-)
                              Peter


_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Gtk2::SimpleList crashes

by Thierry Vignaud :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Peter Daum <gator_ml@...> writes:

> ... I had to slightly rearrange your script so it can produce some output:
> (with your script, there is no error message, just the segfault)
>
> use Gtk2 -init;
> use Gtk2::SimpleList;
> print "Gtk2::VERSION              $Gtk2::VERSION\n";
> print "Gtk2::SimpleList::VERSION  $Gtk2::SimpleList::VERSION\n";
> print "Gtk2->GET_VERSION_INFO     ".join(".",Gtk2->GET_VERSION_INFO)."\n";
> print "Gtk2->get_version_info     ".join(".",Gtk2->get_version_info)."\n";
>
> my $slist = Gtk2::SimpleList->new ('Stuff' => 'text');
>
> @{ $slist->{data} } = qw(one two three four five six seven);
>
> my @data = @{ $slist->{data} };
> @{ $slist->{data} } = @data;
>
> Gtk2::VERSION              1.190
> Gtk2::SimpleList::VERSION  0.15
> Gtk2->GET_VERSION_INFO     2.12.11
> Gtk2->get_version_info     2.12.12
> Segmentation fault

doesn't segfault with perl-5.10.1 rc1 but definitively shows up some
issues:

$ perl /tmp/t.pm
Gtk2::VERSION              1.221
Gtk2::SimpleList::VERSION  0.15
Gtk2->GET_VERSION_INFO     2.17.2
Gtk2->get_version_info     2.17.7
Gtk-CRITICAL **: gtk_list_store_get_value: assertion `VALID_ITER (iter, list_store)' failed at /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi/Gtk2/SimpleList.pm line 248.
[gperl_sv_from_value] FIXME: unhandled type - 0 ((null) fundamental for (null))
$ rpm -q perl perl-Gtk2 gtk+2.0
perl-5.10.0-27mdv2010.0.x86_64
perl-Gtk2-1.221-1mdv2010.0.x86_64
gtk+2.0-2.17.7-3mdv2010.0.i586
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Gtk2::SimpleList crashes

by Thierry Vignaud :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Peter Daum <gator_ml@...> writes:

> Actually, in my case, any array assignment will crash; This is enough:
>
> use Gtk2 -init;
> use Gtk2::SimpleList;
> my $slist = Gtk2::SimpleList->new ('Stuff' => 'text');
> @{ $slist->{data} } = qw(one two three four five six seven);
>
> while the same row by row works:
>
> push @{ $slist->{data} }, $_
>   foreach (qw(one two three four five six seven));
>
> The code in the thread that you quoted looks pretty different, but
> there is one striking similarity:
>
> When the same code runs under the debugger, it won't crash !
>
> (Now I understand why I had such a hard time debugging my
> original code ;-)

works fine with perl-5.10.1 rc1

There were several known issues in 5.10.0 for those we backported fixes
but Debian did too. See patches from :
http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/perl/current/?pathrev=411235
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list

Re: Gtk2::SimpleList crashes

by Kevin Ryde :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thierry Vignaud <tvignaud@...> writes:
>
> Gtk-CRITICAL **: gtk_list_store_get_value: assertion `VALID_ITER (iter, list_store)' failed at /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi/Gtk2/SimpleList.pm line 248.

Yep, me too with 2.16.5 and 5.10.0.

I think the way Gtk2::SimpleList::TiedRow::CLEAR() does a $model->clear
invalidates the iters in TiedRow objects in @data.  I suppose

    my @data = @{ $slist->{data} };

is a kind of shallow copy, giving refs to the rows instead of actual
contents, so if the row is deleted then the TiedRow in that @data is no
good.

Perhaps TiedRow might have to use Gtk2::TreeRowReference instead of just
an iter to be safe against its row being deleted (including when all
rows are deleted by ->clear).  It wouldn't make a copy through @data
like this work, but it'd not-work in a better way :-).
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@...
http://mail.gnome.org/mailman/listinfo/gtk-perl-list