| Ticket UUID: | 485803 | |||
| Title: | suspect code in tkImage.c | |||
| Type: | Bug | Version: | obsolete: 8.4a4 | |
| Submitter: | dgp | Created on: | 2001-11-26 22:25:44 | |
| Subsystem: | 39. Image Basics | Assigned To: | ericm | |
| Priority: | 5 Medium | Severity: | ||
| Status: | Closed | Last Modified: | 2002-02-04 05:33:34 | |
| Resolution: | Fixed | Closed By: | ericm | |
| Closed on: | 2002-02-03 22:33:34 | |||
| Description: |
A compiler warning about unreachable code in
generic/tkImage.c brought my attention to
lines 371-377:
371 if (masterPtr->typePtr != NULL) {
372 for (imagePtr = masterPtr->instancePtr; imagePtr
!= NULL;
373 imagePtr = imagePtr->nextPtr) {
374 count = 1;
375 break;
376 }
377 }
The unconditional break inside the for loop
does look suspect. Is it meant to be a
break in the case statement? Worth a look
by the maintainer anyway.
| |||
| User Comments: |
ericm added on 2002-02-04 05:33:34:
Logged In: YES user_id=86324 I think the original intent was to actually count the number of times the image was in use and return that value, but it was decided that a boolean return was more appropriate. The original loop just didn't get cleanup up properly. I've checked in a correction. nijtmans added on 2001-12-18 19:40:46: Logged In: YES
user_id=61031
In the changelog can be found:
* generic/tkImage.c (Tk_ImageObjCmd): Added [image inuse]
command,
which provides a means for programmers to determine if a
given
image is in use by any widgets. [RFE: 3327].
This [image inuse] command is committed by Eric Melsky,
therefore I better transfer this question to him: Is this
break intended to be a break in the case statement?
From the code, I suspect that the answer is No, and the for-
loop can simply be changed in an if-statement:
if (masterPtr->typePtr != NULL) {
if (masterPtr->instancePtr != NULL) {
count = 1;
}
}
| |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki