diff options
| author | Matthias Melcher <github@matthiasm.com> | 2024-01-14 16:58:34 +0100 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2024-01-14 16:58:34 +0100 |
| commit | 31daa83f2b507e287725a7cf648ae5b51effbabf (patch) | |
| tree | 36c2b695eb34adc15748254bd421bf8bb4b64daa /src | |
| parent | da6791d492241b8f2632f8df003e9d936d997b82 (diff) | |
#877: Formatting, comments, debug output
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Shared_Image.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Fl_Shared_Image.cxx b/src/Fl_Shared_Image.cxx index 21aedd40a..4a9f91393 100644 --- a/src/Fl_Shared_Image.cxx +++ b/src/Fl_Shared_Image.cxx @@ -222,7 +222,7 @@ void Fl_Shared_Image::release() { Fl_Shared_Image *the_original = NULL; #ifdef SHIM_DEBUG - printf("----> Fl_Shared_Image::release() %016x\n", this); + printf("----> Fl_Shared_Image::release() %d %s %d %d\n", original_, name_, w(), h()); print_pool(); #endif @@ -230,12 +230,13 @@ void Fl_Shared_Image::release() { refcount_ --; if (refcount_ > 0) return; + // If this image is not the original, find the original image and make sure + // to delete its reference counter as well at the end of this method. if (!original()) { Fl_Shared_Image *o = find(name()); - if (o && o->original() && o!=this) { - the_original = o; - } if (o) { + if (o->original() && o!=this && o->refcount_>1) + the_original = o; // mark to release later o->release(); // release from find() operation } } @@ -262,12 +263,14 @@ void Fl_Shared_Image::release() { alloc_images_ = 0; } #ifdef SHIM_DEBUG - printf("<---- Fl_Shared_Image::release() %016x\n", this); + printf("<---- Fl_Shared_Image::release() %d %s %d %d\n", original_, name_, w(), h()); print_pool(); printf("\n"); #endif + + // Release one reference count in the original image as well. if (the_original) - the_original->release(); // release as a reference to this copy of the image + the_original->release(); } /** Reloads the shared image from disk. */ |
