Tk Source Code

Check-in [d13e6a58]
Login

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

Overview
Comment:Fix refcount bug in FreeFontObjProc. Could result in freeing a TkFont which was already freed.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-5-branch
Files: files | file ages | folders
SHA1: d13e6a580c5dc5cc56a23f4eee7a129cc5b159f4
User & Date: jan.nijtmans 2013-10-31 21:25:00
Context
2013-11-03
11:29
[1632447]: Allow the PPM maxval to go up to 65535, to conform with a format definition change from around 2000 (even if that's a rare format). check-in: 85a3e256 user: dkf tags: core-8-5-branch
2013-10-31
21:25
Fix refcount bug in FreeFontObjProc. Could result in freeing a TkFont which was already freed. check-in: 61cefa0e user: jan.nijtmans tags: trunk
21:25
Fix refcount bug in FreeFontObjProc. Could result in freeing a TkFont which was already freed. check-in: d13e6a58 user: jan.nijtmans tags: core-8-5-branch
08:51
Put extern "C" guards around all stub table struct definitions, so it is usable to be used for C++ compilers as well without the danger of modifying the calling convention. For tkDecls.h, ttkDecls.h tkIntXlibDecls.h is was no problem, because tk.h, tkTheme.h and Xlib.h already contain those guards. But not for the other *Decls.h files. check-in: 39acb6d0 user: jan.nijtmans tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tkFont.c.

1518
1519
1520
1521
1522
1523
1524
1525
1526

1527
1528
1529
1530
1531
1532
1533
{
    TkFont *fontPtr = (TkFont *) objPtr->internalRep.twoPtrValue.ptr1;

    if (fontPtr != NULL) {
	fontPtr->objRefCount--;
	if ((fontPtr->resourceRefCount == 0) && (fontPtr->objRefCount == 0)) {
	    ckfree((char *) fontPtr);
	    objPtr->internalRep.twoPtrValue.ptr1 = NULL;
	}

    }
}

/*
 *---------------------------------------------------------------------------
 *
 * DupFontObjProc --







<

>







1518
1519
1520
1521
1522
1523
1524

1525
1526
1527
1528
1529
1530
1531
1532
1533
{
    TkFont *fontPtr = (TkFont *) objPtr->internalRep.twoPtrValue.ptr1;

    if (fontPtr != NULL) {
	fontPtr->objRefCount--;
	if ((fontPtr->resourceRefCount == 0) && (fontPtr->objRefCount == 0)) {
	    ckfree((char *) fontPtr);

	}
	objPtr->internalRep.twoPtrValue.ptr1 = NULL;
    }
}

/*
 *---------------------------------------------------------------------------
 *
 * DupFontObjProc --