diff options
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tkBind.c | 10 | ||||
-rw-r--r-- | generic/tkImgPhInstance.c | 3 | ||||
-rw-r--r-- | generic/tkImgPhoto.c | 50 | ||||
-rw-r--r-- | generic/tkText.c | 12 | ||||
-rw-r--r-- | generic/tkTextDisp.c | 12 | ||||
-rw-r--r-- | generic/tkTextIndex.c | 2 | ||||
-rw-r--r-- | generic/tkTextTag.c | 5 | ||||
-rw-r--r-- | generic/tkWindow.c | 3 |
8 files changed, 56 insertions, 41 deletions
diff --git a/generic/tkBind.c b/generic/tkBind.c index d3fdc96..567c51f 100644 --- a/generic/tkBind.c +++ b/generic/tkBind.c @@ -1260,6 +1260,16 @@ Tk_BindEvent( } } + /* + * Ignore event types which are not in flagArray and all zeroes there. + * Most notably, NoExpose events can fill the ring buffer and disturb + * (thus masking out) event sequences of interest. + */ + + if ((eventPtr->type >= TK_LASTEVENT) || !flagArray[eventPtr->type]) { + return; + } + dispPtr = ((TkWindow *) tkwin)->dispPtr; bindInfoPtr = winPtr->mainPtr->bindInfo; diff --git a/generic/tkImgPhInstance.c b/generic/tkImgPhInstance.c index bd152f2..98aaeab 100644 --- a/generic/tkImgPhInstance.c +++ b/generic/tkImgPhInstance.c @@ -721,8 +721,7 @@ TkImgPhotoFree( PhotoInstance *instancePtr = clientData; ColorTable *colorPtr; - instancePtr->refCount -= 1; - if (instancePtr->refCount > 0) { + if (instancePtr->refCount-- > 1) { return; } diff --git a/generic/tkImgPhoto.c b/generic/tkImgPhoto.c index 3e03f3d..1bd0142 100644 --- a/generic/tkImgPhoto.c +++ b/generic/tkImgPhoto.c @@ -409,7 +409,8 @@ ImgPhotoCmd( Tk_PhotoImageBlock block; Tk_Window tkwin; Tk_PhotoImageFormat *imageFormat; - int imageWidth, imageHeight, matched, length, oldformat = 0; + size_t length; + int imageWidth, imageHeight, matched, oldformat = 0; Tcl_Channel chan; Tk_PhotoHandle srcHandle; ThreadSpecificData *tsdPtr = @@ -446,12 +447,13 @@ ImgPhotoCmd( Tcl_WrongNumArgs(interp, 2, objv, "option"); return TCL_ERROR; } - arg = Tcl_GetStringFromObj(objv[2], &length); - if (strncmp(arg,"-data", (unsigned) length) == 0) { + arg = Tcl_GetString(objv[2]); + length = objv[2]->length; + if (strncmp(arg,"-data", length) == 0) { if (masterPtr->dataString) { Tcl_SetObjResult(interp, masterPtr->dataString); } - } else if (strncmp(arg,"-format", (unsigned) length) == 0) { + } else if (strncmp(arg,"-format", length) == 0) { if (masterPtr->format) { Tcl_SetObjResult(interp, masterPtr->format); } @@ -495,9 +497,10 @@ ImgPhotoCmd( return TCL_OK; } else if (objc == 3) { - const char *arg = Tcl_GetStringFromObj(objv[2], &length); + const char *arg = Tcl_GetString(objv[2]); - if (length > 1 && !strncmp(arg, "-data", (unsigned) length)) { + length = objv[2]->length; + if (length > 1 && !strncmp(arg, "-data", length)) { Tcl_AppendResult(interp, "-data {} {} {}", NULL); if (masterPtr->dataString) { /* @@ -511,7 +514,7 @@ ImgPhotoCmd( } return TCL_OK; } else if (length > 1 && - !strncmp(arg, "-format", (unsigned) length)) { + !strncmp(arg, "-format", length)) { Tcl_AppendResult(interp, "-format {} {} {}", NULL); if (masterPtr->format) { /* @@ -1489,7 +1492,8 @@ ParseSubcommandOptions( * TK_PHOTO_COMPOSITE_* constants. */ NULL }; - int index, c, bit, currentBit, length; + size_t length; + int index, c, bit, currentBit; int values[4], numValues, maxValues, argIndex; const char *option, *expandedOption, *needed; const char *const *listPtr; @@ -1501,7 +1505,8 @@ ParseSubcommandOptions( * optPtr->name. */ - expandedOption = option = Tcl_GetStringFromObj(objv[index], &length); + expandedOption = option = Tcl_GetString(objv[index]); + length = objv[index]->length; if (option[0] != '-') { if (optPtr->name == NULL) { optPtr->name = objv[index]; @@ -1519,7 +1524,7 @@ ParseSubcommandOptions( currentBit = 1; for (listPtr = optionNames; *listPtr != NULL; ++listPtr) { if ((c == *listPtr[0]) - && (strncmp(option, *listPtr, (size_t) length) == 0)) { + && (strncmp(option, *listPtr, length) == 0)) { expandedOption = *listPtr; if (bit != 0) { goto unknownOrAmbiguousOption; @@ -1535,7 +1540,11 @@ ParseSubcommandOptions( */ if (!(allowedOptions & bit)) { - goto unknownOrAmbiguousOption; + if (optPtr->name != NULL) { + goto unknownOrAmbiguousOption; + } + optPtr->name = objv[index]; + continue; } /* @@ -1765,7 +1774,8 @@ ImgPhotoConfigureMaster( const char *oldFileString, *oldPaletteString; Tcl_Obj *oldData, *data = NULL, *oldFormat, *format = NULL; Tcl_Obj *tempdata, *tempformat; - int length, i, j, result, imageWidth, imageHeight, oldformat; + size_t length; + int i, j, result, imageWidth, imageHeight, oldformat; double oldGamma; Tcl_Channel chan; Tk_PhotoImageFormat *imageFormat; @@ -1773,10 +1783,11 @@ ImgPhotoConfigureMaster( args = ckalloc((objc + 1) * sizeof(char *)); for (i = 0, j = 0; i < objc; i++,j++) { - args[j] = Tcl_GetStringFromObj(objv[i], &length); + args[j] = Tcl_GetString(objv[i]); + length = objv[i]->length; if ((length > 1) && (args[j][0] == '-')) { if ((args[j][1] == 'd') && - !strncmp(args[j], "-data", (size_t) length)) { + !strncmp(args[j], "-data", length)) { if (++i < objc) { data = objv[i]; j--; @@ -1789,7 +1800,7 @@ ImgPhotoConfigureMaster( return TCL_ERROR; } } else if ((args[j][1] == 'f') && - !strncmp(args[j], "-format", (size_t) length)) { + !strncmp(args[j], "-format", length)) { if (++i < objc) { format = objv[i]; j--; @@ -1852,9 +1863,10 @@ ImgPhotoConfigureMaster( * Force into ByteArray format, which most (all) image handlers will * use anyway. Empty length means ignore the -data option. */ + int bytesize; - (void) Tcl_GetByteArrayFromObj(data, &length); - if (length) { + (void) Tcl_GetByteArrayFromObj(data, &bytesize); + if (bytesize) { Tcl_IncrRefCount(data); } else { data = NULL; @@ -1870,8 +1882,8 @@ ImgPhotoConfigureMaster( * object. */ - (void) Tcl_GetStringFromObj(format, &length); - if (length) { + (void) Tcl_GetString(format); + if (format->length) { Tcl_IncrRefCount(format); } else { format = NULL; diff --git a/generic/tkText.c b/generic/tkText.c index 412a7f2..6ff1db9 100644 --- a/generic/tkText.c +++ b/generic/tkText.c @@ -1570,8 +1570,7 @@ TextWidgetObjCmd( } done: - textPtr->refCount--; - if (textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } return result; @@ -1964,9 +1963,7 @@ DestroyText( * portion of the text widget. */ - sharedTextPtr->refCount--; - - if (sharedTextPtr->refCount > 0) { + if (sharedTextPtr->refCount-- > 1) { TkBTreeRemoveClient(sharedTextPtr->tree, textPtr); /* @@ -2042,13 +2039,12 @@ DestroyText( } textPtr->tkwin = NULL; - textPtr->refCount--; Tcl_DeleteCommandFromToken(textPtr->interp, textPtr->widgetCmd); if (textPtr->afterSyncCmd){ Tcl_DecrRefCount(textPtr->afterSyncCmd); textPtr->afterSyncCmd = NULL; } - if (textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } } @@ -5526,7 +5522,7 @@ RunAfterSyncCmd( * The widget has been deleted. Don't do anything. */ - if (--textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree((char *) textPtr); } return; diff --git a/generic/tkTextDisp.c b/generic/tkTextDisp.c index 4b7b0db..371e910 100644 --- a/generic/tkTextDisp.c +++ b/generic/tkTextDisp.c @@ -3005,7 +3005,7 @@ AsyncUpdateLineMetrics( * The widget has been deleted, or is not mapped. Don't do anything. */ - if (--textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } return; @@ -3080,8 +3080,7 @@ AsyncUpdateLineMetrics( GenerateWidgetViewSyncEvent(textPtr, 1); - textPtr->refCount--; - if (textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } return; @@ -4163,7 +4162,7 @@ DisplayText( textPtr->refCount++; dInfoPtr->flags &= ~REPICK_NEEDED; TkTextPickCurrent(textPtr, &textPtr->pickEvent); - if (--textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); goto end; } @@ -4299,8 +4298,9 @@ DisplayText( if (TkScrollWindow(textPtr->tkwin, dInfoPtr->scrollGC, dInfoPtr->x, oldY, dInfoPtr->maxX-dInfoPtr->x, height, 0, y-oldY, damageRgn)) { +#ifndef MAC_OSX_TK TextInvalidateRegion(textPtr, damageRgn); - +#endif } numCopies++; TkDestroyRegion(damageRgn); @@ -6752,7 +6752,7 @@ AsyncUpdateYScrollbar( GetYView(textPtr->interp, textPtr, 1); } - if (--textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } } diff --git a/generic/tkTextIndex.c b/generic/tkTextIndex.c index d227bd8..faa1afd 100644 --- a/generic/tkTextIndex.c +++ b/generic/tkTextIndex.c @@ -87,7 +87,7 @@ FreeTextIndexInternalRep( TkTextIndex *indexPtr = GET_TEXTINDEX(indexObjPtr); if (indexPtr->textPtr != NULL) { - if (--indexPtr->textPtr->refCount == 0) { + if (indexPtr->textPtr->refCount-- <= 1) { /* * The text widget has been deleted and we need to free it now. */ diff --git a/generic/tkTextTag.c b/generic/tkTextTag.c index dd3127d..d9329f5 100644 --- a/generic/tkTextTag.c +++ b/generic/tkTextTag.c @@ -1258,8 +1258,7 @@ TkTextFreeTag( if (textPtr != tagPtr->textPtr) { Tcl_Panic("Tag being deleted from wrong widget"); } - textPtr->refCount--; - if (textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } tagPtr->textPtr = NULL; @@ -1522,7 +1521,7 @@ TkTextBindProc( } done: - if (--textPtr->refCount == 0) { + if (textPtr->refCount-- <= 1) { ckfree(textPtr); } } diff --git a/generic/tkWindow.c b/generic/tkWindow.c index 5855b7c..20b4f20 100644 --- a/generic/tkWindow.c +++ b/generic/tkWindow.c @@ -1479,8 +1479,7 @@ Tk_DestroyWindow( winPtr->mainPtr->deletionEpoch++; } - winPtr->mainPtr->refCount--; - if (winPtr->mainPtr->refCount == 0) { + if (winPtr->mainPtr->refCount-- <= 1) { register const TkCmd *cmdPtr; /* |