[Xapian-discuss] Segmentation fault using XapianDateValueRangeProcessor with php-bindings

Sebastian cbimax at gmail.com
Thu Sep 27 01:46:47 BST 2007


Olly !!

2007/9/26, Olly Betts <olly at survex.com>:
> On Wed, Sep 26, 2007 at 02:32:24PM -0300, Sebastian wrote:
> > $objParser->add_valuerangeprocessor( new XapianDateValueRangeProcessor(1) );
>
> Rewrite this as:
>
>   $vrp = new XapianDateValueRangeProcessor(1);
>   $objParser->add_valuerangeprocessor( $vrp );

  It works sublime, as ever..!

  Thanks a lot,

Sebastián


>
> > The enquirer scripts hits a 'Segmentation fault' when issuing
> > $objParser->parse_query(), with <query> 'example 20010101..20070101'.
> > It runs OK any query with other words or phrases except a range...
> > When I remove $objParser->add_valuerangeprocessor( ... ) it goes
> > flawless.
>
> The issue is with the object lifetime.  With your original code, the
> PHP XapianDateValueRangeProcessor object is garbage collected after the
> call to add_valuerangeprocessor, and the underlying C++ object deleted.
>
> It's arguably a bug in the bindings, but I'd like to address it in the
> C++ API because it's annoying there too.  We need to come up with a
> different reference counting approach though, as the one we use for
> most Xapian classes doesn't allow them to be subclassed by the user.
>
> Cheers,
>     Olly
>



More information about the Xapian-discuss mailing list