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 / Weird failure on DeleteImage

Author
Message
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 28th May 2013 19:42 Edited at: 28th May 2013 19:43
This occurs in Windows only with v10812. On all other platforms, the crash does NOT happen and it does NOT happen when the same code (except for the AppGameKit core files and libraries) is run in v1076.

When the app, upon closing, attempts to delete any of a specific set of three images, it crashes.

If the images are not loaded and the app closes, it closes cleanly.

I tried loading the images in a different order. But the app always crashes when the agk:eleteImage command is call for any of the four images (of the 50 something images loaded).

The function that calls DeleteImage first checks for the id being above zero and that the image exists using the GetImageExists command.

Throughout all of my code, there is only one line that calls DeleteImage, in the above mentioned function which is used to do all deletes. I used outputs to a debug log to show the function checking the id, checking existence of the image and then successfully deleting the image. And the function that called this (deleting images stored in a list) prints out the id and name of the file before and after calling TADisplay::delete_image. The debug log was quite clear in showing that the failure was happening on the call to DeleteImage.


The four images are .pngs 512 wide by 64 high.

Since I don't plan to publish this app in Windows (at this time, anyway), it is not a show stopper for me. But it just doesn't make sense.

Attached is the image and here is what it looks like:


Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 28th May 2013 19:55
did you make the graphics self?
what happens if you save this new with gimp2.8 or other software than before.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 28th May 2013 20:09
Yes, I made all of the images myself. I use a combination of Blender (for the 3D affect and animations) and Adobe Photoshop Elements (to put the animations together and other stuff).

The problem only showed up in v10811. It did not happen prior to that. And it persists in v10812.

To further confuse the issue, it only happens when the app is built in Release configuration. When built in Debug configuration, it closes just fine.

And I am definitely using the correct libraries (as delivered) for VS 2010.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 28th May 2013 20:37
the idea save with other tool i said because some
tools can create a little bit invalid pngs.
maybe at b11 the api level change from 9 to 10.
about release/debug sounds bad.

tier1 is ok with beta 12
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 28th May 2013 21:02
I hadn't tested it in Tier 1. And, having now tested it with all four images, there is no apparent error. Either running directly in Windows or through an iOS or Android Player.

But then the Tier 1 app didn't complain when I deliberately ran the delete image loop again (my test app loaded all four images) which should have failed when it tried to delete images that had already been deleted.

This may be a library related error. The Tier 2 VS 2010 Release library may have a bug.

What api are you referring to?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 28th May 2013 21:37
nevermind the api level.
hmm, i thought the entirety core source code are used in c++
as link in a project. (i did not use c++ with agk as yet)
it appear only with this 4 images and u use much more,i understand,true?
maybe is there a error log info from this debug mode lib u use.
just a idea:
SetErrorMode
GetErrorOccurred
GetLastError
?
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 28th May 2013 22:54
That is strange, is it possible you could send me the project?
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 28th May 2013 23:35
I have also experienced weird crashes upon deleting images?

I ended up on only using manual ids and deleting them manually to get it down to a minimum.

Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 29th May 2013 00:01
Probably wrong, but it sounds like a pointer not being nulled at the delete point, and a subsequent call to an invalid address.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 29th May 2013 00:13
Markus, there is no error shown in the log I create, just an absence of the final delete message and the app crashes. It works fine in Debug mode, not in Release mode.

I tried using 'try {x} catch (int e) {}' and it didn't work because the error occurring somewhere down in AppGameKit in the DeleteImage command didn't trickle back up.

Paul, I have sent the project (basically the same one you looked at before but with some code updates and project directory changes). I uncommented the code that does the debug file output.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 29th May 2013 01:08
maybe it looks like ok in debug mode but if deleteimage
use something like on error resume next its possible to
get a LastError message from it, that's was i mean.
paul will find it
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Jun 2013 21:49 Edited at: 4th Jun 2013 22:07
I discovered that I was getting the same error on my iOS device (crash when delete a particular image). Discovered with the help of my TADebugConsole class.

So I went back to trying to figure it out. I tried all combinations of changing the order of when the images (it was a set of four that appeared to be doing it), creating new images from scratch of the same size, using another image that was big enough for the animation (even though it did not have the frames) and that had deleted cleanly, and others.

It came down to whatever images were loaded in that class initialisation (there really should NOT be a 'z' in that word!) would cause a crash when the cleanup came.

So I tried to figure out what was different.

It came down to the class dynamically creating an array of integers and storing the image id in that array (something only done in this class, and now I cannot figure out why I even had the array for that storage). As soon as I deleted all the lines associated with it, the bug went away. Still makes no sense, but the problem disappeared.

The array was declared as a class static member like this inside the class definition in the header file:


In the code file it was used like this:


The 'add_loaded_image' function sets the value of i_mid to the loaded image and returns true on failure.


The code even crashed when I substituted 'i_mid' for 'gold_img_ids\[i\]' in the call to 'TADisplay::add_id_to_auto'. Which was wierd.

As far as I can tell, there is nothing wrong with the array I created or how I used it. And it really doesn't look like it should have influenced anything.

But removing all the code associated with it made the problem go away.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 5th Jun 2013 02:17
I might have found it -

Your for loop starts at 1 and goes to (and including) max_gold_count, the same size of your gold_img_ids array but with an offset of 1. So you're going out of bounds by 1...if I'm reading it correctly.

Try gold_img_ids[i-1] = i_mid;

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jun 2013 04:24
Oooh! Huge hand Smack to head!

Boy, I looked at the code dozens of times. This is why you get a fresh set of eyes on things.

Thanks. That is probably what it was.

But, having discovered that I don't need the array (and I don't remember why I was intending to use it for).

Thank you.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 5th Jun 2013 10:48
@Hodgey:
Good catch - blame shifted away from AppGameKit, this time.

@AncientLady

Quote: "initialisation (there really should NOT be a 'z' in that word!)"


A few comments about "Initialization" vs "Initialisation".

Since English isn't my native language, saying that "initialization" should not have the letter z in it, makes me go for the dictionary faster than you can blink.

I had a hunch that this might be a difference between the American English and British English versions, which it turns out to be.

The American version is "initialization" (with z), while especially the British English version is "initialisation" (with an s).
Every dictionary I've looked at seems to confirm this.

Although I think most of my education was slightly biased toward the British English, I've picked up A LOT of American spelling versions in my own vocabulary, which I find hard to let go. And won't, actually - but I'm always keen to do a checkup on correct usage.

http://oald8.oxfordlearnersdictionaries.com/dictionary/initialize
http://oxforddictionaries.com/definition/english/initialize
http://www.merriam-webster.com/dictionary/initialize
http://dictionary.cambridge.org/dictionary/british/initialize
http://dictionary.reference.com/browse/initialize
http://www.thefreedictionary.com/initialize

Cheers,
AgentSam
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 5th Jun 2013 13:10
Quote: "But, having discovered that I don't need the array (and I don't remember why I was intending to use it for)."

Yeah, you can now have arrays of image or sprite points. But it sounds like you didn't need an array of any kind at all. What I find interesting is that it only happened with Beta12. Just a coincidence maybe?

Quote: "Good catch - blame shifted away from AppGameKit, this time."

I do my best to defend it, especially the tier 2 side .

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jun 2013 17:02
AgentSam, I am aware of the English vs American 's' vs 'z' issue. I am from the US (American should NOT really refer only to US citizens, another thing that annoys me) and am married to an Australian. He is who I learned the difference from. And I agree with him about zed being wrong. Maybe, if I set my language settings to English (British), the browser will stop trying to correct me.

And I am very glad to finally realize that it was not an AppGameKit issue. Neither Paul nor I could figure out how it could be.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 5th Jun 2013 17:26
Quote: "And I agree with him about zed being wrong."


So, it's a matter of opinion?

Cheers,
AgentSam
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jun 2013 19:35
Quote: "So, it's a matter of opinion?"

Yes and no. First, it is a regional thing. And then you can decide which you prefer to use. But spell checkers will catch you out and one should always take into account one's audience (as in writing a resume).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Jun 2013 20:51
There is a difference of opinion over this between dictionary compilers. Many maintain that the z form is British English and the s form American.

My partner Gillie insists on z and I prefer s. She has a Chemistry degree and mine is English and Philosophy, so I claim the moral high ground!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL

Login to post a reply

Server time is: 2024-11-24 16:01:28
Your offset time is: 2024-11-24 16:01:28