Itk - the [incr Tk] extension

Check-in [46e858f9ac]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Sep 9.

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

Overview
Comment:[6acb6a8363] When Itk_AddOptionPart() fails, be sure no remnant of the failed attempt remains to lead to nasty double free.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dgp-method-type
Files: files | file ages | folders
SHA1:46e858f9ac3f01ecfdc1c97b8da79cbbc35e1219
User & Date: dgp 2017-07-10 18:32:51
Context
2017-07-28
16:57
Several revisions to get evaluation contexts more reliably correct. Closed-Leaf check-in: b46f3c3fe0 user: dgp tags: dgp-method-type
2017-07-25
20:35
Attempt to make code say clearly what it does, instead of achieving so much with namespace context games. check-in: 4af9618d9b user: dgp tags: experiment
2017-07-10
18:32
[6acb6a8363] When Itk_AddOptionPart() fails, be sure no remnant of the failed attempt remains to lead to nasty double free. check-in: 46e858f9ac user: dgp tags: dgp-method-type
2017-06-29
17:17
Bump to 4.1.0 check-in: c368859cb1 user: dgp tags: dgp-method-type
Changes
Hide Diffs Unified Diffs Show Whitespace Changes Patch

Changes to generic/itkArchBase.c.

2251
2252
2253
2254
2255
2256
2257

2258
2259
2260
2261
2262
2263
2264
....
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287

2288
2289
2290
2291
2292
2293
2294
2295
2296

2297
2298
2299
2300
2301
2302
2303
    char *currVal,                   /* current value (or NULL) */
    ArchOptionPart *optPart,         /* part to be added in */
    ArchOption **raOpt)              /* returns: option containing new part */
{
    CONST char *init = NULL;
    int result;
    ArchOption *archOpt;


    *raOpt = NULL;
    archOpt = NULL;

    /*
     *  Find or create a composite option for the mega-widget.
     */
................................................................................

    /*
     *  Add the option part to the composite option.  If the
     *  composite option has already been configured, then
     *  simply update this part to the current value.  Otherwise,
     *  leave the configuration to Itk_ArchInitCmd().
     */
    Itcl_AppendList(&archOpt->parts, (ClientData)optPart);

    if ((archOpt->flags & ITK_ARCHOPT_INIT) != 0) {

        if (result == TCL_OK) {
            init = Tcl_GetVar2(interp, "itk_option", archOpt->switchName, 0);
        }

        if (!init) {
            Itk_ArchOptAccessError(interp, info, archOpt);

            return TCL_ERROR;
        }

        if (!currVal || (strcmp(init,currVal) != 0)) {
            result  = (*optPart->configProc)(interp, info->itclObj,
                optPart->clientData, init);

            if (result != TCL_OK) {
                Itk_ArchOptConfigError(interp, info, archOpt);

                return TCL_ERROR;
            }
        }
    }

    *raOpt = archOpt;
    return TCL_OK;







>







 







|









>









>







2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
....
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
    char *currVal,                   /* current value (or NULL) */
    ArchOptionPart *optPart,         /* part to be added in */
    ArchOption **raOpt)              /* returns: option containing new part */
{
    CONST char *init = NULL;
    int result;
    ArchOption *archOpt;
    Itcl_ListElem *elemPtr;

    *raOpt = NULL;
    archOpt = NULL;

    /*
     *  Find or create a composite option for the mega-widget.
     */
................................................................................

    /*
     *  Add the option part to the composite option.  If the
     *  composite option has already been configured, then
     *  simply update this part to the current value.  Otherwise,
     *  leave the configuration to Itk_ArchInitCmd().
     */
    elemPtr = Itcl_AppendList(&archOpt->parts, (ClientData)optPart);

    if ((archOpt->flags & ITK_ARCHOPT_INIT) != 0) {

        if (result == TCL_OK) {
            init = Tcl_GetVar2(interp, "itk_option", archOpt->switchName, 0);
        }

        if (!init) {
            Itk_ArchOptAccessError(interp, info, archOpt);
	    Itcl_DeleteListElem(elemPtr);
            return TCL_ERROR;
        }

        if (!currVal || (strcmp(init,currVal) != 0)) {
            result  = (*optPart->configProc)(interp, info->itclObj,
                optPart->clientData, init);

            if (result != TCL_OK) {
                Itk_ArchOptConfigError(interp, info, archOpt);
		Itcl_DeleteListElem(elemPtr);
                return TCL_ERROR;
            }
        }
    }

    *raOpt = archOpt;
    return TCL_OK;