Tcl Source Code

Check-in [de751a3490]
Login

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

Overview
Comment:Fix reference counting for command structure in TclNRApplyObjCmd
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | bug-3422267ed6b79922
Files: files | file ages | folders
SHA3-256: de751a349009f88aee604a5d543695eb414bf3d70c906c7caa3da59306f87b74
User & Date: pooryorick 2020-08-12 14:46:22
References
2020-08-12
18:15 Ticket [3422267ed6] segmentation fault from deleting the the target of an imported alias during a trace on the target of the alias status still Open with 3 other changes artifact: 5726b0cac3 user: pooryorick
Context
2020-08-12
17:33
Initialize Proc.cmdPtr to NULL when creating a new procedure. check-in: b9d1a1ce1a user: pooryorick tags: bug-3422267ed6b79922
14:46
Fix reference counting for command structure in TclNRApplyObjCmd check-in: de751a3490 user: pooryorick tags: bug-3422267ed6b79922
13:31
body of test case for [3422267ed6b79922]. check-in: 2da1596304 user: pooryorick tags: bug-3422267ed6b79922
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclProc.c.

2690
2691
2692
2693
2694
2695
2696

2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711





2712
2713
2714
2715
2716
2717
2718

    extraPtr->efi.length = 1;
    extraPtr->efi.fields[0].name = "lambda";
    extraPtr->efi.fields[0].proc = NULL;
    extraPtr->efi.fields[0].clientData = lambdaPtr;
    extraPtr->cmd.clientData = &extraPtr->efi;


    result = TclPushProcCallFrame(procPtr, interp, objc, objv, 1);
    if (result == TCL_OK) {
	TclNRAddCallback(interp, ApplyNR2, extraPtr, NULL, NULL, NULL);
	result = TclNRInterpProcCore(interp, objv[1], 2, &MakeLambdaError);
    }
    return result;
}

static int
ApplyNR2(
    ClientData data[],
    Tcl_Interp *interp,
    int result)
{
    ApplyExtraData *extraPtr = (ApplyExtraData *)data[0];






    TclStackFree(interp, extraPtr);
    return result;
}

/*
 *----------------------------------------------------------------------







>


|












>
>
>
>
>







2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724

    extraPtr->efi.length = 1;
    extraPtr->efi.fields[0].name = "lambda";
    extraPtr->efi.fields[0].proc = NULL;
    extraPtr->efi.fields[0].clientData = lambdaPtr;
    extraPtr->cmd.clientData = &extraPtr->efi;

    procPtr->refCount++;
    result = TclPushProcCallFrame(procPtr, interp, objc, objv, 1);
    if (result == TCL_OK) {
	TclNRAddCallback(interp, ApplyNR2, extraPtr, procPtr, NULL, NULL);
	result = TclNRInterpProcCore(interp, objv[1], 2, &MakeLambdaError);
    }
    return result;
}

static int
ApplyNR2(
    ClientData data[],
    Tcl_Interp *interp,
    int result)
{
    ApplyExtraData *extraPtr = (ApplyExtraData *)data[0];
    Proc *procPtr = (Proc *)data[1];
    procPtr->cmdPtr = NULL;
    if (procPtr->refCount-- <= 1) {
	TclProcCleanupProc(procPtr);
    }

    TclStackFree(interp, extraPtr);
    return result;
}

/*
 *----------------------------------------------------------------------