[Xapian-discuss] Visibility Problem in Perl Bindings for MultiValueSorter

Olly Betts olly at survex.com
Thu Jan 24 02:46:14 GMT 2008


On Mon, Jan 14, 2008 at 09:46:07PM +0100, Markus W?rle wrote:
> {
>     my $sorter = new Search::Xapian::MultiValueSorter(1,2);
>     $enq->set_sort_by_key($sorter);
> }
> my $mset = $enq->get_mset(0, 5);
> 
> segfaults in get_mset(), [...]
> 
> I think there is a visibility-problem in the XS or C++ code. Looks  
> like the $enq object just contains a reference on the sorter, and as  
> soon as the referee becomes invisible it breaks.

Yes - the C++ reference counting system we currently use doesn't
allow us to reference count user-subclassable classes so Xapian::Sorter
isn't reference counted by Xapian itself.

I've fixed this for now the way Search::Xapian handles similar cases,
which is to increment the reference count and deliberately leak the
Sorter object.  Not ideal, but the best we can easily do right now.

There's a bug open for the underlying issue:

http://www.xapian.org/cgi-bin/bugzilla/show_bug.cgi?id=186

Cheers,
    Olly



More information about the Xapian-discuss mailing list