Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2004-04-26
16:47 • Closed ticket [940843ffff]: crash scanning dict with zero entries plus 7 oth... artifact: 632df433c8 user: dkf
2004-04-23
16:17 • New ticket [940843ffff]. artifact: cde88ea4ce user: dgp

crash scanning dict with zero entries

Closed / Fixed940843ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2004-04-23 16:17:07
It appears this causes a crash:

int done = 0;
Tcl_DictSearch search;
Tcl_Obj *keyPtr;
Tcl_Obj *dictPtr;

dictPtr = Tcl_NewObj();
Tcl_DictObjFirst(NULL, dictPtr, &search, &keyPtr, NULL,
&done);
Tcl_DictObjDone(&search);    /* CRASH! */

Perhaps this is pilot error, and the caller
must coded like so:

if (!done) {
    Tcl_DictObjDone(&search);
}

but if so, maybe a friendlier interface is worth
considering (or sterner warnings in the docs).
dkfplain2004-04-26 16:47:28
Logged In: YES 
user_id=79902

This is indeed pilot error.  I've strengthened the wording
in the documentation and added an example as well.
Log in (anonymous is fine) to add a comment.