summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tkImgPhInstance.c3
-rw-r--r--generic/tkText.c12
-rw-r--r--generic/tkTextDisp.c9
-rw-r--r--generic/tkTextIndex.c2
-rw-r--r--generic/tkTextTag.c5
-rw-r--r--generic/tkWindow.c3
6 files changed, 13 insertions, 21 deletions
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/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 1be26c4..704d47d 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;
}
@@ -6752,7 +6751,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;
/*