Strange memory access error

Blitz3D Forums/Blitz3D Programming/Strange memory access error

Mr.Waterlily(Posted 2007) [#1]
I discovered a weird problem.

I do this:
1. Run my blitzprogram in windowmode.
2. Start another program than runs in fullscreen, like a game.
3. Close the program I just started.
4. Either tabs back to my blitzprogram, or click it in the startmenu.
5. Immediately I get a Memory Access Violation.

Why?

This does not happen if I run my program in fullscreen.
and it only happens when I start any other program that runs in fullscreen.

It doesnīt matter if I have debug on or off. Nor does it matter if I run it from the IDE or from a compiled .exe.

When I have debug on I can see where it stops, and it is on a "Line 1, a+1, b-1, a+1". And I have checked those variables and the are fine.

Now, I know that Blitz are not the most WinGUI/Alt-TAB/minimize friendly environment, but I need to know if I can do anything to remove this error, or not.

Or is this a known error that I wasnīt aware of?
(Not impossible ;))


GfK(Posted 2007) [#2]
One is trying to run in GL, the other in DX?

Had similar problems myself with Blitzmax. I'd imagine a DX/GL conflict isn't Blitzmax specific though.


(tu) ENAY(Posted 2007) [#3]
Actually this has been a problem with any Blitz program from Day 1 (not in Blitzmax though if I recall)

Any utility or game running in Windowed mode will instantly crash if you try to change your resolution to another in windows, when you went to full screen, windows changed the resolution.

Try it, every Blitz program in Windowed mode you own should crash when you change resolution.


jfk EO-11110(Posted 2007) [#4]
But he wasn't chanching the resolution, did he?

I've seen some machines that couldn't run multiple DX 3D-initialized (Graphics3D) windows at a time. That was a DirectX or card issue, AFAIR.

I've just tested the described condition on my ol 98se with radeon9200se. There is in fact a problem, but it isn't a MAV here. when I tabbed back to the windowed app (no matter if Graphics or Graphics3D) then the inner window was invisible, transparent. (In fact a window :o) ). I then added a "if-keyit then reset graphics3d ",this worked. Altough, the graphics must be reloaded after a new Graphics3D call.


Mr.Waterlily(Posted 2007) [#5]
Iīm not changing the resolution of my blitzprogram.
The window can be of any size, and I can change it if I want to and that works fine.

Itīs only when it runs in a window(minimized or not), and I start any other program that opens its own fullscreen.
I have tested several programs, and itīs all the same.
One was a old DOS-game, one was WinUAE(amiga emulator), and some other programs.

As soon as another program starts a fullscreen, my blitsprog is doomed, when it gets activaded.

If I run my prog in fullscreen, I can start as many other programs I want. It all works fine, and my blitzprog also works.


Mr.Waterlily(Posted 2007) [#6]
Perhaps I should add that I open up my window using Graphics, NOT Graphics3D.

And I havenīt tested if the problem is there with Graphics3D, but I would guess that it remains.


LAB[au](Posted 2007) [#7]
If you open a program in fullscreen it changes windows resolution.


Mr.Waterlily(Posted 2007) [#8]
Yes, and apparently blitzprograms in window mode does not like when another program opens up a fullscreen.

The question remains, can this error be avoided somehow?


(tu) ENAY(Posted 2007) [#9]
> The question remains, can this error be avoided somehow?

Nope, going full screen changes the resolution in Windows, even if it's the same resolution you're full screening into. The problem is I recall is that your parameters are getting lost, ie Your image and sounds. Thus when your program comes back to Windows it can't find them anymore, they're gone and then your program crashes.

Get some source code, load your images and then call the Graphics3D command again, now try to draw them, CRASH!

If there's a fix, I don't know of one.


Mr.Waterlily(Posted 2007) [#10]
Well, itīs not my blitzprogram that changes the resolution by calling Graphics, that is the problem. If so, then I could handle that.

But if youīre saying that when another program opens a fullscreen it sort of indirectly does the same as blitz Graphics, and so my loaded images is gone?
Or is it the same as doing a CloseGraphics?

I donīt think thats the case here, but I need to do some tests on this.


jfk EO-11110(Posted 2007) [#11]
Did you try it with a blitz windowed app that didn't set the Graphics at all? (Simply use the initial 400*300 window). Not sure but there's a chance that this runs in non DirectX mode. If this works without MAV then it may be the other Fullscreen app that is doing bad things with the DirectX enviroment. Maybe :o)


Mr.Waterlily(Posted 2007) [#12]
I tried just a basic test with the default window and there was no MAV.

Since itīs only the blitzprograms that crash I assume that thereīs something thatīs not properly handled by the blitz engine.

So thereīs probably nothing to do, except wait for an update that fixes this, or tell the user not to open any other fullscreen program.. ;)

Unless someone has a tricky workaroud?