Crashing on exit

Archives Forums/Linux Discussion/Crashing on exit

JazzieB(Posted 2005) [#1]
Just wondering if anyone else has had this problem and whether there is any way around it.

Basically, I have MEPIS installed, which works great with all my hardware and BlitzMax programs, but I am having problems with two of my programs (and as luck would have it, the two I want to release as freeware!). They work without a problem until you come to exit, at which point Linux and possibly the programs themselves lock up! This only happens when the games are ran in full screen mode (windowed mode runs perfectly).

Now for the weird bit... Everything else I have written in BlitzMax works without a problem - full screen, windowed and at all resolutions from 640x480 up to 1024x768 (the games run at 1024x768 and 800x600, btw).

At first I thought this was an audio problem, as that was the only difference between my games and the various other stuff I have written. However, I have completely stripped out all audio from one of the games and the same thing happens!

Here's what else I have done.

1. Added EndGraphics before End
2. Manually freed all media and used FlushMem before EndGraphics.
3. Loaded graphics instead of using Incbin.
4. Taken out End

None of this has had any effect. I even forced the program to write to a text file as it closed to see if I could spot where it halted, if at all. It goes through every step without a problem, so either my game is crashing at the point it closes or Linux is crashing when it tries to re-establish the desktop.

Incidentally, the result of the crash is that the game screen can still be seen on top of the desktop in the upper left corner of the screen. The IDE and the rest of the desktop is behind this 'window'. I run my desktop at 1280x1024.

I'm running MEPIS, a Debian based Linux, Kernal 2.6, KDE desktop (the latest version) and I have an ATI Radeon 9800 Pro graphics card.

So, does anybody have any ideas on what to try next?


Craig Watson(Posted 2005) [#2]
I can try the programs out for you if you want, seeing as they're freeware anyway. You could also try to run it from a terminal and see if there are any error messages being written back - assuming of course you can find a way to see the terminal once the app has crashed.

I notice you're using an ATI graphics card. Do you happen to know what version of their drivers you're using? I have NVidia on both my machines at home, so if it works without crashing, might be a clue.

FYI: If X craps up like that, you can use Ctrl+Alt+Backspace to kill it, and it should return you to your login prompt.


JazzieB(Posted 2005) [#3]
Ok. The current full version, which runs in full-screen with all the audio, can be downloaded from here. It's in ZIP form, so you'll need to extract it first.

The drivers I have installed, according to the ATI Control Panel, are 8.10.19.

I already know how to get out of X when it crashes like that, but thanks anyway.

Let me know if you have the same problem and any other advice would be appreciated.


Craig Watson(Posted 2005) [#4]
Does the same thing here I'm afraid. It didn't want to die nicely either.

Are you using any Frameworks when you compile? The thing I've noticed is that your executable does not include a link to libXxf86vm.so.1 whereas all of mine do. Not sure if that's significant though.

Running from the terminal returns nothing of interest either because the program never manages to terminate.


JazzieB(Posted 2005) [#5]
I am using Framework, but I also use it in all of my other programs that actually exit without a problem. However, I tried removing it to see what would happen and nothing changed.

I've now manually freed all media before exiting and this hasn't changed anything either.

It really is very mystifying why most of my other stuff works without a problem, but I cannot get these two games to work no matter what I do. I really don't want to resort to only releasing the games as windowed only, as they were intended to be full-screen games. Plus, windowed mode is only meant for debugging at the moment anyway.

I've had a look at the ATI site to see what the latest drivers are and it appears that they are currently up to version 8.16.20, where mine are 8.10.19. So, it looks like my last ditch attempt is to update my drivers; something which scares me on Linux, being something of a newbie! Having said that, you were still having the problem on NVidia, so it may not be a driver issue. In which case, I'm stumped!

If that doesn't work, it either appears to be a bug with BlitzMax when closing, or an incompatibility issue with Linux or KDE.


skidracer(Posted 2005) [#6]
Try adding

XCloseDisplay(xdisplay);

to the end of the bbGLExit() function in glgraphics.linux.c

You could also wait for the next release of BlitzMax which is imminent to see if that doesn't solve your problems.


JazzieB(Posted 2005) [#7]
Thanks for the tip, Skidracer. However, upon opening the source I find that the XCloseDisplay(xdisplay); call is already in there...

void bbGLExit()
{
	bbGLGraphicsClose( _currentContext );
	if (cursor)
	{	
		XFreeCursor(xdisplay,cursor);
		cursor=0;
	}
	XCloseDisplay(xdisplay);
	xdisplay=0;
}


That is the right function, isn't it? What about the cursor bit, could that have anything to do with it? Probably not, but I might as well ask.

So, when is the next update? ;o)