Itcl - the [incr Tcl] extension

Check-in [11b92daedc]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:2nd segfault-fix of [1dc2d851eb], cases "sfbug-254.2/-254.3" - no base/superclass without oo-machinery (if oo-subsystem is deleted, ::itcl::Root is not available anymore), tests passed now
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | bug-1dc2d851eb
Files: files | file ages | folders
SHA3-256: 11b92daedc8daee5a752c955cdf5411f341aca7994ab6d1d95a3a57d5839e2dc
User & Date: sebres 2019-02-08 23:08:07.950
Context
2019-02-08
23:13
extend test case illustrating still one segfault, still create class, but now with other base (inheritance that was removed with oo-subsystem) check-in: 1c9c7d5c9e user: sebres tags: bug-1dc2d851eb
23:08
2nd segfault-fix of [1dc2d851eb], cases "sfbug-254.2/-254.3" - no base/superclass without oo-machinery (if oo-subsystem is deleted, ::itcl::Root is not available anymore), tests passed now check-in: 11b92daedc user: sebres tags: bug-1dc2d851eb
22:38
small amend: simplifying code and cleanup in error check-in: 31b795fefd user: sebres tags: bug-1dc2d851eb
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/itclClass.c.
243
244
245
246
247
248
249








250
251
252
253
254
255
256
    ItclVariable *ivPtr;
    Tcl_HashEntry *hPtr;
    void *callbackPtr;
    int result;
    int newEntry;
    ItclResolveInfo *resolveInfoPtr;
    Tcl_Obj *cmdNamePtr;









    /*
     * check for an empty class name to avoid a crash
     */
    if (strlen(path) == 0) {
	Tcl_AppendResult(interp, "invalid class name \"\"", NULL);
        return TCL_ERROR;







>
>
>
>
>
>
>
>







243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
    ItclVariable *ivPtr;
    Tcl_HashEntry *hPtr;
    void *callbackPtr;
    int result;
    int newEntry;
    ItclResolveInfo *resolveInfoPtr;
    Tcl_Obj *cmdNamePtr;

    if (!infoPtr->clazzClassPtr 
	|| !(oPtr = Tcl_GetClassAsObject(infoPtr->clazzClassPtr))
	|| Tcl_ObjectDeleted(oPtr)
    ) {
	Tcl_AppendResult(interp, "oo-subsystem is deleted", NULL);
	return TCL_ERROR;
    }

    /*
     * check for an empty class name to avoid a crash
     */
    if (strlen(path) == 0) {
	Tcl_AppendResult(interp, "invalid class name \"\"", NULL);
        return TCL_ERROR;
Changes to tests/sfbugs.test.
304
305
306
307
308
309
310
311

























312
313
314
315
316
317
318
    if {[catch {
      $interp eval {
        ::itcl::class ::test {}
      }
    } msg]} {
      lappend ::test_status $msg
    }
} -result {{::oo::class destroy worked} {::test does not refer to a class}} \

























  -cleanup {interp delete $interp}

test sfbug-255 { SF bug #255
} -body {
    set ::test_status ""

    proc ::sfbug_255_do_uplevel { body } {







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
    if {[catch {
      $interp eval {
        ::itcl::class ::test {}
      }
    } msg]} {
      lappend ::test_status $msg
    }
} -result {{::oo::class destroy worked} {oo-subsystem is deleted}} \
  -cleanup {interp delete $interp}

test sfbug-254.3 { delete oo-subsystem should remove all classes + bug [1dc2d851eb]
} -body {
    set interp [interp create]
    set ::test_status ""
    $interp eval [::tcltest::loadScript]
    $interp eval {
      package require itcl

      ::itcl::class ::test {}
    }
    lappend ::test_status "::test class created"
    $interp eval {
      oo::class destroy
    }
    lappend ::test_status "::oo::class destroy worked"
    if {[catch {
      $interp eval {
        ::test x
      }
    } msg]} {
      lappend ::test_status $msg
    }
} -result {{::test class created} {::oo::class destroy worked} {invalid command name "::test"}} \
  -cleanup {interp delete $interp}

test sfbug-255 { SF bug #255
} -body {
    set ::test_status ""

    proc ::sfbug_255_do_uplevel { body } {