Tcl Source Code

Check-in [722088eb1f]
Login

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

Overview
Comment:Prevent leaks of the Object structs of oo::object and oo::class.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | memleak
Files: files | file ages | folders
SHA3-256: 722088eb1ff4260d552ac4f7756a2e5c028a69aef71087d336d793a86912b247
User & Date: dgp 2018-03-11 21:14:41.021
Context
2018-03-13
20:41
Audit and correct Object reference counting issues. check-in: 821793c082 user: pooryorick tags: memleak
2018-03-11
21:15
plug memleaks check-in: b087783022 user: dgp tags: core-8-6-branch
21:14
Prevent leaks of the Object structs of oo::object and oo::class. check-in: 722088eb1f user: dgp tags: memleak
18:08
Attempt at providing the missing instance squelcher. check-in: a8a64455ae user: dgp tags: memleak
Changes
Unified Diff Ignore Whitespace Patch
Changes to generic/tclOO.c.
548
549
550
551
552
553
554









555
556
557
558
559
560
561
    ClientData clientData,	/* Pointer to the OO system foundation
				 * structure. */
    Tcl_Interp *interp)		/* The interpreter containing the OO system
				 * foundation. */
{
    Foundation *fPtr = GetFoundation(interp);










    TclDecrRefCount(fPtr->unknownMethodNameObj);
    TclDecrRefCount(fPtr->constructorName);
    TclDecrRefCount(fPtr->destructorName);
    TclDecrRefCount(fPtr->clonedName);
    TclDecrRefCount(fPtr->defineName);
    ckfree(fPtr);
}







>
>
>
>
>
>
>
>
>







548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
    ClientData clientData,	/* Pointer to the OO system foundation
				 * structure. */
    Tcl_Interp *interp)		/* The interpreter containing the OO system
				 * foundation. */
{
    Foundation *fPtr = GetFoundation(interp);

    /*
     * Crude mechanism to avoid leaking the Object struct of the
     * foundation components oo::object and oo::class
     *
     * Should probably be replaced with something more elegantly designed.
     */
    while (TclOODecrRefCount(fPtr->objectCls->thisPtr) == 0) {};
    while (TclOODecrRefCount(fPtr->classCls->thisPtr) == 0) {};

    TclDecrRefCount(fPtr->unknownMethodNameObj);
    TclDecrRefCount(fPtr->constructorName);
    TclDecrRefCount(fPtr->destructorName);
    TclDecrRefCount(fPtr->clonedName);
    TclDecrRefCount(fPtr->defineName);
    ckfree(fPtr);
}