Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Error when quiting program

Author
Message
Mandemon
8
Years of Service
User Offline
Joined: 1st Jan 2016
Location: Finland
Posted: 4th Jan 2016 20:26 Edited at: 4th Jan 2016 20:31
Tier 2 program. Runs fine, but when I try to end it, I get an error.

This is what I get from running .exe
Quote: "
Debug error!

Program: ...ts\AGK\Libraries\apps\Revolution Mapeditor\Final\Template.exe

abort() has been called

(Press Retry to debug the program)"


And then it gives me 3 options, to retry, ignore and retry

This is what I get from debug:
Quote: "
Unhandled exception at 0x7744D8A8 in Template.exe: Microsoft C++ exception: std::out_of_range at memory location 0x0018F778."


If I say continue after that, I get
Quote: "
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 4th Jan 2016 20:48
Have you ended your program with the command END?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Mandemon
8
Years of Service
User Offline
Joined: 1st Jan 2016
Location: Finland
Posted: 4th Jan 2016 20:56 Edited at: 4th Jan 2016 20:57
Tier 2, so I am using C++. and END is not available to me- I clicked the x button at the top-right corner of the screen.
Mandemon
8
Years of Service
User Offline
Joined: 1st Jan 2016
Location: Finland
Posted: 5th Jan 2016 06:16 Edited at: 5th Jan 2016 06:17
Update: I have managed to locate error area. It's in the End() function which is called by the core.cpp when the program ends. Here is my implementation of it




As far as I have managed to locate the error, issue happens when I try to delete sprites in buttons vector . While C++ and AppGameKit do take care of garbage collection themselves, I prefer to do my own cleanup so I know that the stuff has been deleted from the memory-
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 5th Jan 2016 06:31
This error is happening because something that's already been deleted/freed from memory is attempting to be accessed in some way. I would have to see how you're declaring some of these things, but I suspect (based on the snippets you posted) it has something to do with either mainMap or your DataStruct class. If you post your DataStruct class here as well as your mainMap declaration I can probably narrow down the issue. You can also find the culprit by commenting out line by line from "app::End" (start at "delete mainMap" at work your way up) and when the error stops you've found the issue. However, it could have nothing to do with "app::End" and instead be some memory that you freed earlier on (incorrectly) that is now trying to free itself when the application closes.



Sean
Mandemon
8
Years of Service
User Offline
Joined: 1st Jan 2016
Location: Finland
Posted: 5th Jan 2016 07:31 Edited at: 5th Jan 2016 07:32
Whelp, aren't I an idiot.

Take a look at for-loops. I had i++ when comparing values, no wonder it goes out of bounds. It starts from 1 and then increments it with 2 each loop (once normal increment, then increment again in comparison). So it will always go out of bounds.

Login to post a reply

Server time is: 2024-09-29 09:17:11
Your offset time is: 2024-09-29 09:17:11