Author Topic: *** Unhandled exception *** when quit window?  (Read 2152 times)

Offline pinete

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
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!

MrTAToad

  • Guest
Re: *** Unhandled exception *** when quit window?
« Reply #1 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 ?

Offline pinete

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: *** Unhandled exception *** when quit window?
« Reply #2 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!

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: *** Unhandled exception *** when quit window?
« Reply #3 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.

Offline pinete

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: *** Unhandled exception *** when quit window?
« Reply #4 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?

Offline Quentin

  • Prof. Inline
  • *****
  • Posts: 915
    • View Profile
Re: *** Unhandled exception *** when quit window?
« Reply #5 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]

Offline Slydog

  • Prof. Inline
  • *****
  • Posts: 930
  • KodeSource
    • View Profile
    • KodeSource
Re: *** Unhandled exception *** when quit window?
« Reply #6 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.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

MrTAToad

  • Guest
Re: *** Unhandled exception *** when quit window?
« Reply #7 on: 2011-Sep-23 »
Possibly also divide by 0 would do it...

Are you using GLB_ON_QUIT ?
« Last Edit: 2011-Sep-23 by MrTAToad »

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10715
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: *** Unhandled exception *** when quit window?
« Reply #8 on: 2011-Sep-26 »
unhandled exception is bad. Can you send me the project you're using? Sorry :(

Offline pinete

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: *** Unhandled exception *** when quit window?
« Reply #9 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?
« Last Edit: 2011-Sep-26 by pinete »

Offline ampos

  • Prof. Inline
  • *****
  • Posts: 1594
    • View Profile
    • AMpostata Website
Re: *** Unhandled exception *** when quit window?
« Reply #10 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.
check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Offline pinete

  • Mr. Drawsprite
  • **
  • Posts: 98
    • View Profile
Re: *** Unhandled exception *** when quit window?
« Reply #11 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
« Last Edit: 2011-Sep-26 by pinete »

MrTAToad

  • Guest
Re: *** Unhandled exception *** when quit window?
« Reply #12 on: 2011-Sep-26 »
Thats why I thought you were using ON_QUIT...

I think you need to make the complete project available though.
« Last Edit: 2011-Sep-26 by MrTAToad »