Opened 19 years ago

Closed 15 years ago

Last modified 8 years ago

#62 closed defect (fixed)

How to use the Tcl binding so cleanup works

Reported by: Michael Schlenker Owned by: Olly Betts
Priority: low Milestone: 1.1.5
Component: Xapian-bindings Version: SVN trunk
Severity: trivial Keywords:
Cc: Blocked By:
Blocking: Operating System: All

Description (last modified by Olly Betts)

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

Change History (5)

comment:1 by Olly Betts, 19 years ago

It sounds like something isn't quite right inside SWIG, but I don't think I'm qualified to investigate it, since I don't know tcl or the inside of SWIG,

I've added your observations to the tcl bindings documentation, so at least people can work around this problem.

comment:2 by Olly Betts, 19 years ago

Status: newassigned

comment:3 by Olly Betts, 18 years ago

Operating System: All
Priority: highlow

comment:5 by Olly Betts, 16 years ago

Description: modified (diff)

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

comment:6 by Olly Betts, 15 years ago

Milestone: 1.1.5
Resolution: fixed
Status: assignedclosed

As of Xapian 1.1.0, using WritableDatabase's close method is a good way to avoid this whole issue. I've added a note about this to the Tcl8 docs in r14125 (for 1.1.5), and I'm going to close this ticket now - I think we've addressed this as well as we easily can.

Last edited 8 years ago by Olly Betts (previous) (diff)
Note: See TracTickets for help on using tickets.