[Xapian-tickets] [Xapian] #186: User subclassable classes should be reference counted

Xapian nobody at xapian.org
Thu Mar 14 06:28:49 GMT 2013


#186: User subclassable classes should be reference counted
-------------------------+--------------------------------------------------
 Reporter:  richard      |        Owner:  olly     
     Type:  defect       |       Status:  new      
 Priority:  normal       |    Milestone:  1.3.x    
Component:  Library API  |      Version:  SVN trunk
 Severity:  normal       |   Resolution:           
 Keywords:               |    Blockedby:           
 Platform:  All          |     Blocking:           
-------------------------+--------------------------------------------------
Changes (by olly):

 * cc: olly (removed)
 * cc: richard (added)
  * owner:  nobody => olly
  * milestone:  2.0.0 => 1.3.x


Old description:

> MatchDeciders should be subclasses of RefCntBase, so that they can be
> reference
> counted.  This would allow classes like MultipleMatchDecider to keep a
> reference
> count to the match deciders in it, avoiding the risk of the deciders used
> in it
> being freed before the match decider is used.
>
> This will involve and API and ABI change, so will have to wait for 1.1.0

New description:

 !MatchDeciders should be subclasses of !RefCntBase, so that they can be
 reference
 counted.  This would allow classes like !MultipleMatchDecider to keep a
 reference
 count to the match deciders in it, avoiding the risk of the deciders used
 in it
 being freed before the match decider is used.

 This will involve and API and ABI change, so will have to wait for 1.1.0

--

Comment:

 I've had an idea about this - if we provide ref() and unref() methods, we
 can make this work for the bindings without having to expose how the ref
 counts are handled internally, and provide a nice simple API to the
 mechanism required.

 And we can also provide a "release()" method (maybe there's a better
 name?) which allows C++ users to hand ownership of the object to the class
 it is set on (see the new testcase in the patch I'm about to attach).

 The really nice thing is that if you don't call these methods, things work
 as they do already - i.e. this is API compatible with existing user code
 (but not ABI compatible).  So it's 1.3.x material.

-- 
Ticket URL: <http://trac.xapian.org/ticket/186#comment:23>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list