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

Overview
Comment:Plugged obscure mem leak.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | schema
Files: files | file ages | folders
SHA3-256: 8b0f0e9ecc88b54808a2f5722ed8df2e4cd8531b39be6f1c085bce99fc95d643
User & Date: rolf 2019-11-09 00:54:19
Context
2019-11-13
17:06
Added info line and info column to retrieve parsing position information. Made the interfaces for position information using a long for this. Tried to prevent concurrent use of a schema command - a schema command may be busy. Added book-keeping code to prevent seg fault, if a schema command is configured as validation command for a SAX parser or DOM building and the schema command is deleted on the way at script level. check-in: e5d39024c8 user: rolf tags: schema
2019-11-09
16:56
wip check-in: d10c95ec06 user: rolf tags: wip
00:54
Plugged obscure mem leak. check-in: 8b0f0e9ecc user: rolf tags: schema
2019-11-06
20:55
Merged from trunk. check-in: 34fdc85dfb user: rolf tags: schema
Changes

Changes to generic/schema.c.

3566
3567
3568
3569
3570
3571
3572












3573
3574
3575
3576
3577
3578
3579
....
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
            break;
        }
        break;
    }
    return TCL_OK;
}













int
schemaInstanceCmd (
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
    )
................................................................................
            }
        } else {
            if (objc == 4) {
                Tcl_SetVar (interp, Tcl_GetString (objv[3]),
                            Tcl_GetStringResult (interp), 0);
            }
            if (sdata->evalError) {
                return TCL_ERROR;
            } else {
                SetBooleanResult (0);
            }
        }
        schemaReset (sdata);
        break;








>
>
>
>
>
>
>
>
>
>
>
>







 







|







3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
....
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
            break;
        }
        break;
    }
    return TCL_OK;
}

/* This implements the script interface to the created schema commands.

   Since validation may call out to tcl scripts those scripts may
   delete the schema command (which just validates input by calling
   out to a tcl script). This is handled by tcl evaluation level
   counting and postponing the schema data deletion until back on top.

   After any code by this function that may have called out to a tcl
   script it is important not to return locally but to signal the
   return value with the result variable and ensure to reach the code
   at the end of schemaInstanceCmd.
 */
int
schemaInstanceCmd (
    ClientData clientData,
    Tcl_Interp *interp,
    int objc,
    Tcl_Obj *const objv[]
    )
................................................................................
            }
        } else {
            if (objc == 4) {
                Tcl_SetVar (interp, Tcl_GetString (objv[3]),
                            Tcl_GetStringResult (interp), 0);
            }
            if (sdata->evalError) {
                 result = TCL_ERROR;
            } else {
                SetBooleanResult (0);
            }
        }
        schemaReset (sdata);
        break;

Changes to tests/schema.test.

2152
2153
2154
2155
2156
2157
2158




















2159
2160
2161
2162
2163
2164
2165
    lappend result [s validate <wrong/>]
    s start mydoc
    lappend result [s validate <doc/>]
    s delete
    set result
} {1 0 0}





















test schema-9.1 {choice} {
    tdom::schema create grammar
    grammar define {
        defelement doc foouri {
            choice * {
                element e1
                element e2







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
    lappend result [s validate <wrong/>]
    s start mydoc
    lappend result [s validate <doc/>]
    s delete
    set result
} {1 0 0}

proc schema-8.7 {scmd} {
    global result
    lappend result "in schema-8.7"
    $scmd delete
    error "this is deliberate"
}
test schema-8.7 {Delete schema cmd in script called by validation} {
    set result ""
    lappend result [info commands s]
    tdom::schema s
    lappend result [info commands s]
    s defelement doc {
        tcl schema-8.7
    }
    lappend result [catch {s validate <doc/>} errMsg]
    lappend result $errMsg
    lappend result [info commands s]
    lappend result [catch {s delete}]
} {{} s {in schema-8.7} 1 {error "this is deliberate" at line 1 character 6} {} 1}

test schema-9.1 {choice} {
    tdom::schema create grammar
    grammar define {
        defelement doc foouri {
            choice * {
                element e1
                element e2