Thanks for the tips:

The first one doesn't prevent the segmentation fault.
The second is the method I used as a workaround, using a helper function to
create the glob regexp from the pattern strings used by the GCstar program.



Date: Sun, 29 Dec 2019 20:35:55 +0100
> From: Torsten Schoenfeld <torsten.schoenf...@gmx.de>
> To: gtk-perl-list@gnome.org
> Subject: Re: Bug in Gtk3::FileFilter?
> Message-ID: <0db43a0d-6526-1da2-3bf7-189829aad...@gmx.de>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> .....
>
> This does indeed seem to be a bug in Gtk3/Glib::Object::Introspection.
> The problem is with this call to add_custom():
>
>      $filter->add_custom('filename', sub {
>          my $ctx = shift;
>          return 0 if ((! defined $ctx) || (! defined $ctx->{filename}));
>          my $filename = lc($ctx->{filename});
>          return ($filename =~ m/.html?$/);
>          });
>
> On the C level, this sets up the filter info struct ($ctx in the above)
> to only contain a valid filename.  The other fields contain garbage.
> But the C -> Perl converter does not know this and tries to access these
> other fields anyways, hence the occasional crash.
>
> Workarounds:
>
> * Use $filter->add_custom([qw/filename uri display-name mime-type/],
>    sub { ... }) to ensure that all fields contain valid data.
>
> * Simply use something like $filter->add_pattern('*.[hH][tT][mM][lL]?').
>
>
>
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list

Reply via email to