[Xapian-tickets] [Xapian] #62: How to use the Tcl binding so cleanup works

Xapian nobody at xapian.org
Wed Dec 24 04:52:02 GMT 2008


#62: How to use the Tcl binding so cleanup works
-----------------------------+----------------------------------------------
 Reporter:  schlenk          |        Owner:  olly     
     Type:  defect           |       Status:  assigned 
 Priority:  low              |    Milestone:           
Component:  Xapian-bindings  |      Version:  SVN trunk
 Severity:  trivial          |   Resolution:           
 Keywords:                   |    Blockedby:           
 Platform:  All              |     Blocking:           
-----------------------------+----------------------------------------------

Old description:

> The current Tcl binding has problems with cleanup, sometimes the
> destructor does
> not get called and other nuisances.
>
> I did some small experiments with the binding and found, that the
> constructor
> gets called in some cases and not in others:
>
> This works:
> xapian::WritableDatabase xapiandb testdir
> $::xapian::DB_CREATE_OR_OVERWRITE
> rename xapiandb ""
>
> This seems it does not:
> xapian::WritableDatabase xapiandb testdir
> $::xapian::DB_CREATE_OR_OVERWRITE
> set db xapiandb
> $db -delete
>
> neither does this
> set db [xapian::WritableDatabase xapiandb testdir
> $::xapian::DB_CREATE_OR_OVERWRITE]
> $db -delete
>
> or this:
> set db [xapian::WritableDatabase xapiandb testdir
> $::xapian::DB_CREATE_OR_OVERWRITE]
> rename $db ""
>
> I'm not sure if it is a problem with the SWIG wrapping, but thing there
> are some
> subtle problems somewhere in there.
>
> Michael

New description:

 The current Tcl binding has problems with cleanup, sometimes the
 destructor does
 not get called and other nuisances.

 I did some small experiments with the binding and found, that the
 destructor
 gets called in some cases and not in others:

 This works:

 {{{
 xapian::WritableDatabase xapiandb testdir
 $::xapian::DB_CREATE_OR_OVERWRITE
 rename xapiandb ""
 }}}

 This seems it does not:

 {{{
 xapian::WritableDatabase xapiandb testdir
 $::xapian::DB_CREATE_OR_OVERWRITE
 set db xapiandb
 $db -delete
 }}}

 neither does this

 {{{
 set db [xapian::WritableDatabase xapiandb testdir
 $::xapian::DB_CREATE_OR_OVERWRITE]
 $db -delete
 }}}

 or this:

 {{{
 set db [xapian::WritableDatabase xapiandb testdir
 $::xapian::DB_CREATE_OR_OVERWRITE]
 rename $db ""
 }}}

 I'm not sure if it is a problem with the SWIG wrapping, but thing there
 are some
 subtle problems somewhere in there.

 Michael

--

Comment(by olly):

 (wiki format description and fix typo: "constructor"->"destructor")

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



More information about the Xapian-tickets mailing list