GLBasic forum

Main forum => GLBasic - en => Topic started by: pinete on 2011-Sep-22

Title: *** Unhandled exception *** when quit window?
Post by: pinete on 2011-Sep-22
Hi,
I'm obtaining this error in the log just when quit clicking on "x" top right on the game window

*** Unhandled exception ***
   EXCEPTION_ACCESS_VIOLATION

the game seems to work perfectly but I get this error, and sometime, also when quit, apperars the typical error window saying that mygame.exe doesn't work, what do you want to do, quit or wait to this applications works again...

Any hint about the reason this is related to or the reason because this uses to happen?

Thanks in advance!
Title: Re: *** Unhandled exception *** when quit window?
Post by: MrTAToad on 2011-Sep-22
It would sound like you aren't using SHOWSCREEN in the game loop, or as often as you should.

For example, this code could cause it :

Code (glbasic) Select
WHILE TRUE
WEND


Do you have any example code ?
Title: Re: *** Unhandled exception *** when quit window?
Post by: pinete on 2011-Sep-23
Thanks so much MrTAToad,
Code is very long as I've not any suspect of a specific part of code :P so I guess it could be a madness copy here in the forum :P
re the example you gave me, I'm pretty sure I'm doing well, I've just one' Showscreen' in the mail program loop, that's all.
Do you have any other idea why this can happen?
Do you want me to send you the code to a private email address?
Thanks!
Title: Re: *** Unhandled exception *** when quit window?
Post by: Quentin on 2011-Sep-23
sounds like a "out of bounds" exception, e.g. accessing a non existing array index. You should try to run your program in debug mode. Often you'll get some more details about the specific error.
Title: Re: *** Unhandled exception *** when quit window?
Post by: pinete on 2011-Sep-23
Hi Quentin:)
I'm running in debug but it just says that when quits.. the game is normally executed showing no errors during game.. :P
is possible that's produced by an array and GLBasic just notify it when you quit?
Title: Re: *** Unhandled exception *** when quit window?
Post by: Quentin on 2011-Sep-23
was just an idea. If the debugger is switched on, you'll possibly see some messages in the output window of the GLBasic IDE

here's a stupid sample:



[attachment deleted by admin]
Title: Re: *** Unhandled exception *** when quit window?
Post by: Slydog on 2011-Sep-23
A tedious idea to narrow down the problem could be adding DEBUG statements to the start and end of each function.
That way you you'll know what function was executing just before the crash.
Then you could narrow that function down further with more DEBUG statements.
Title: Re: *** Unhandled exception *** when quit window?
Post by: MrTAToad on 2011-Sep-23
Possibly also divide by 0 would do it...

Are you using GLB_ON_QUIT ?
Title: Re: *** Unhandled exception *** when quit window?
Post by: Kitty Hello on 2011-Sep-26
unhandled exception is bad. Can you send me the project you're using? Sorry :(
Title: Re: *** Unhandled exception *** when quit window?
Post by: pinete on 2011-Sep-26
Hi Gernot, of course I can, how can I do that? what email account in order to give you my FTP?
thanks a lot for your help, I appreciate so much.

MrTAToad, nop, I'm not using GLB_ON_QUIT.. :/ Should I do it?
Title: Re: *** Unhandled exception *** when quit window?
Post by: ampos on 2011-Sep-26
I got this msg because I was accesing an array with a big negative number.

Code (glbasic) Select
Z=Z-1000
a=arr[z]


Z was supposed to be 1001 or so, but I type -10000 instead of -1000.
Title: Re: *** Unhandled exception *** when quit window?
Post by: pinete on 2011-Sep-26
really strange fact is that the game works properly and I just get the error when I click on the windows' close button to close the app, then the error message appears in the debug window...  :blink: So I wonder.. thinking about the possibility of the cause is an array out of range... It should not be the program who communicates this problem during runtime?
I've got before array errors and the program stops and GLBasic debug windows shows you the specific error.. :P
Title: Re: *** Unhandled exception *** when quit window?
Post by: MrTAToad on 2011-Sep-26
Thats why I thought you were using ON_QUIT...

I think you need to make the complete project available though.