(bitmap)
| 372 | * Side effects: |
| 373 | * The reference count associated with bitmap is decremented, and |
| 374 | * it is officially deallocated if no-one is using it anymore. |
| 375 | * |
| 376 | *---------------------------------------------------------------------- |
| 377 | */ |
| 378 | |
| 379 | void |
| 380 | Tk_FreeBitmap(bitmap) |
| 381 | Pixmap bitmap; /* Bitmap to be released. */ |
| 382 | { |
| 383 | Tcl_HashEntry *idHashPtr; |
| 384 | register TkBitmap *bitmapPtr; |
| 385 | |
| 386 | if (!initialized) { |
| 387 | panic("Tk_FreeBitmap called before Tk_GetBitmap"); |
| 388 | } |
| 389 | |
| 390 | idHashPtr = Tcl_FindHashEntry(&idTable, (char *) bitmap); |
| 391 | if (idHashPtr == NULL) { |
| 392 | panic("Tk_FreeBitmap received unknown bitmap argument"); |
| 393 | } |
| 394 | bitmapPtr = (TkBitmap *) Tcl_GetHashValue(idHashPtr); |
| 395 | bitmapPtr->refCount--; |
| 396 | if (bitmapPtr->refCount == 0) { |
| 397 | XFreePixmap(bitmapPtr->display, bitmapPtr->bitmap); |
| 398 | Tcl_DeleteHashEntry(idHashPtr); |
| 399 | Tcl_DeleteHashEntry(bitmapPtr->hashPtr); |
| 400 | ckfree((char *) bitmapPtr); |
no test coverage detected