Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Crash in oo-0.7

Closed / Fixed3547839fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 14 years ago
Descriptionplain2012-07-24 10:03:17
Hi,

I appear to have a reproducible crash in TclOO.  This needs independent confirmation as I am building using my own CMake script, in the absence of native MSVC build support in the tcloo repo.

Details:

Build setup (32-bit): 'Setting environment for using Microsoft Visual Studio 2010 x86 tools'
Testing platform: Windows 7 (64-bit), PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 30 Stepping 5, GenuineIntel

Crash in oo-0.7, debugger reveals:
  subclassPtr->thisPtr = 0xdddddddd 
  in ReleaseClassContents(), tclOO.c:831

Minimal script to reproduce (in tclsh85tg.exe):
  package require TclOO
  namespace path oo
  object destroy ;# segfault
dkfplain2012-07-27 02:48:07
Can't reproduce using a standard build of Tcl 8.5 on OSX, but do hit something with a memdebug build.
dkf Ticket [3547839fff]: 1 change [History diff]2012-07-27 02:48:24
dkfplain2012-07-27 02:56:12
Reproduces with:

  package require TclOO;::oo::object destroy

Problem is that the structure pointed to by subclassPtr has been released (memdebug builds scribble over deallocated structures deliberately) *before* we've got to the point where we apply checks to ensure that we don't delete it too early. (Indeed, it's crashing in the code that's incrementing the reference counts to prevent this from happening.)
dkfplain2012-07-27 02:58:29
Also, this does *not* 8.6; that gets this protection code correct.

(Dropped the Group to stop confusing dgp.)
dkfplain2012-07-27 04:11:04
allow_comments - 1

Used the object finalization code from 8.6, which works (and already survives tests very much like this when built in memdebug mode).
Log in (anonymous is fine) to add a comment.