Author Topic: [v2.1 dev build] $DEBUG - problem with _FREEIMAGE ...  (Read 2316 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
[v2.1 dev build] $DEBUG - problem with _FREEIMAGE ...
« on: November 30, 2021, 06:50:52 pm »
@FellippeHeitor

9f81ba1 dev build   Windows x64 Pro 21H1 Nov updated


When switching around various sources and using _FREEIMAGE ... eg with the partial code below

t& = _NEWIMAGE(wdth, hght,32)
SCREEN t&

...

IF t& < -1 then _FREEIMAGE t&   'This is line xxx
_SOURCE t&


get   "Error occurred on line xxx" message  and $DEBUG does not reach my breakpoint.


As $DEBUG now stands - it is totally un-useable for me when I have _FREEIMAGE code.

FellippeHeitor

  • Guest
Re: [v2.1 dev build] $DEBUG - problem with _FREEIMAGE ...
« Reply #1 on: November 30, 2021, 07:05:48 pm »
I don't know where your breakpoint is, but are you freeing the current SCREEN? That's an invalid operation and Debug mode is giving you the right message if it's telling you an error occurred. Need more context.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: [v2.1 dev build] $DEBUG - problem with _FREEIMAGE ...
« Reply #2 on: November 30, 2021, 07:33:12 pm »


@FellippeHeitor

Some more info regarding this.  The other source I am switching around with is the whole display (which has the $DEBUG IDE on the right hand side, whereas what I am testing is on the left hand side, sometimes right hand side, but mainly the top of screen).

The $DEBUG error never seems to occur with _FREEIMAGE s&, ONLY with _FREEIMAGE t&.

Note that the t& source relates to only the very top of the display (non-overlapping with $DEBUG IDE).

I am beginning to understand the conflict - at present only one monitor used - if I added a second (low quality) monitor, is it possible (and how), to have $DEBUG IDE only display on the second monitor

When $DEBUG reports the error, after about a second or two, it carries on until the next  _FREEIMAGE t& and so on...

The breakpoint occurs when the program is accessing the very top of the display.

t& = _NEWIMAGE(wdth, hght,32)
SCREEN t&

...

if s& <-1 then _freeimage s&
s& = _SCREENIMAGE
_SOURCE s&
...

IF t& < -1 then _FREEIMAGE t&   'This is line xxx
_SOURCE t&

FellippeHeitor

  • Guest
Re: [v2.1 dev build] $DEBUG - problem with _FREEIMAGE ...
« Reply #3 on: November 30, 2021, 08:00:59 pm »
Now that was too much detail. Focus on this:

SCREEN t& 'when you do this, you instruct your program to use image t& as the display surface.
'at this point t& < -1 is true, because t& is a valid image and all valid images are < -1
'if you try to FREE the current display image, it will error.

It has nothing to do with second monitors and stuff. It has nothing to do with $Debug either and will fail without it too.
Can you confirm that you're trying to free the active screen? If that's the case, that's an invalid operation.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: [v2.1 dev build] $DEBUG - problem with _FREEIMAGE ...
« Reply #4 on: November 30, 2021, 08:32:57 pm »
@FellippeHeitor

t& source is my "Mission Control Style "TaskBar"" (it is 3200 x 100 and located at the very top of the display) - my regular Windows TaskBar is at the bottom of the display.

The switching between t& and s& has been working for many months in normal mode (i.e. without debug being used at all). Without the _freeimage t& or s&, I was getting a severe memory leak (the switch-overs are more than 100 per hour).

Just today I have been trying to add a small change to my "Mission Control Style TaskBar"  - but I have a problem that it cannot write to a file anywhere - hence why I am even using $DEBUG.

Part of the requirement of the Mission Control Style TaskBar program (focus t&) is to obtain information from anywhere on the whole screen as needed.