Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
graceful way to test for a valid image handle such as before doing _FreeImage?
#3
Code: (Select All)

SUB FreeImage (handle AS LONG)
   IF handle < -1 THEN 
     _FREEIMAGE handle
    handle = 0
   END IF
END SUB

Just write your own freeimage routine and have it *always* set to handle back to 0 when it's freed the handle.

If a handle isn't loaded at all, then it's going to be 0.
If a handle is > 0 then it's going to be a screen handle and not needing to be freed.
Only LOAD when handles are 0 or -1, and only FREE when the handle is < -1 and then set the handle back to 0.

It's about the easiest way to deal with the issue that I know of.
Reply


Messages In This Thread
RE: graceful way to test for a valid image handle such as before doing _FreeImage? - by SMcNeill - 11-11-2025, 12:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Test to post a new Thread + question 32 or 64 bit Rudy M 2 538 09-09-2025, 04:10 PM
Last Post: Rudy M
  A strange experience with forum posting an image TempodiBasic 2 523 06-17-2025, 06:01 AM
Last Post: TempodiBasic
  QB64PE programming challenge? auto-convert image to photoreal etch-a-sketch drawing madscijr 9 1,824 02-14-2025, 05:49 PM
Last Post: madscijr
  Got a slow PC? Test these changes, kindly! SMcNeill 7 1,715 05-16-2024, 09:59 PM
Last Post: grymmjack
  When to free an image? James D Jarvis 5 1,130 04-16-2023, 08:55 PM
Last Post: OldMoses

Forum Jump:


Users browsing this thread: 1 Guest(s)