GLB_ON_RESUME iOS6 CRASHES

Previous topic - Next topic

aroldo

Hi I am having difficulties with GLB_ON_PAUSE, GLB_ON_RESUME and GLB_ON_QUIT on iOS 6.
I am testing my code on an iPhone 4S.

I have set AUTOPAUSE TRUE in the beginning of my code.

My game starts fine the I press the "home" button and the app goes in the back ground.
When I click on my app icon, the program resumes were it stopped and them after feel seconds QUITS.
As you can see the on the Debug log below from Xcode GLB_ON_PAUSE is called and GLB_ON_RESUME is also called

I see that iOS asked the app to free memory. Can these be the reason my program is quitting  after resume?

Here is the Debug from Xcode:

Init Finalized
Loading Music: Media/sounds/intro.mp3
Status: 0
-applicationWillResignActive   -> pause
[GLB]->PAUSE
-applicationDidEnterBackground -> pause
2012-12-27 22:16:01.719 iPhone[4895:907] Received memory warning.
-applicationDidReceiveMemoryWarning - free mem=5160 kB
-applicationWillEnterForeground-> do nothing
-applicationDidBecomeActive    -> unpause
[GLB]->RESUMED
[GLB]->QUIT
Shut down GLB
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
glb is shut down
exit

Here a portion of  the code:
Code (glbasic) Select

SUB GLB_ON_QUIT:
GOSUB saveGame
debu ("QUIT")
ENDSUB
SUB GLB_ON_PAUSE:
OSPaused=TRUE
debu ("PAUSE")
ENDSUB
SUB GLB_ON_RESUME:
OSPaused=FALSE
debu ("RESUMED")
ENDSUB
FUNCTION debu: data_in$
?IFDEF IPHONE
STDOUT "[GLB]->" + data_in$ + "\n"
?ELSE
DEBUG "[GLB]->" + data_in$ + "\n"
?ENDIF
ENDFUNCTION

[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

Kitty Hello

Is this the V11 beta or the V10?

aroldo

[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

Kitty Hello

Please try v11 beta. For iOS it's pretty stable.

aroldo

Ok I will try and will let you know.
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

aroldo

Gernot,

I compiled my Game on the GLBasic IDE Version 11.261 and the same problem persists:

My game starts fine then I press the "home" button and the app goes in the background.
When I click on my app icon, the program resumes were it stopped and them after feel seconds QUITS.
If I double click the Home button my app shows in the list of apps running, at this point when I click on my app it tries to resume but instead it reload the program.

I also tried a small application and got the same results:

XCode Debug Info for my Small App
Init Finalized
Rbow::SetScreen( 320,480)
-applicationWillResignActive   -> pause
[GLB]->PAUSE
-applicationDidEnterBackground -> pause
-applicationWillEnterForeground-> do nothing
-applicationDidBecomeActive    -> unpause
[GLB]->RESUMED
[GLB]->QUIT
Shut down GLB
glb is shut down
exit

Looking at the log I see that after resume the GLB_ON_RESUME it calls GLB_ON_QUIT. Why??
Am I forgetting something on the GLB_ON_RESUME?


XCode Debug Info for my GAME

init with frame.
App wants to support retina...
Retina scaleing available: self.contentScaleFactor = 2.000000
desktop backing: 640 x 960
mainScreen: 640x960
glb_notify_screen_size 640x960
slaunch ok
-applicationDidBecomeActive    -> unpause
2013-01-04 23:26:09.847 BrickBuster[2934:907] Application windows are expected to have a root view controller at the end of application launch
timer
rbow
rbow init
Rbow::SetScreen( 640,960)
get accurate timer - 1st call
flip - 1st call
BGRA ext supported
Texture size limit: 4096
init fbo
2D VP
OGRB init [OK]
Cptn
Network
Input
Window mode
Create DXin
reptr
getexe
cd
exepath=curdir= /var/mobile/Applications/A2A72D36-167E-4091-8AA5-A61DDAA9A323/BrickBuster.app
shoeboxing...
init gettimer
clear screen
flip
mk2D
finding font...
AudioStreamBasicDescription:  2 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
Init Finalized
loadeffect - i: 0 eff: 2400
loadeffect - i: 1 eff: 2402
loadeffect - i: 2 eff: 2404
loadeffect - i: 3 eff: 2406
loadeffect - i: 0 eff: 2408
loadeffect - i: 0 eff: 2410
loadeffect - i: 0 eff: 2412
loadeffect - i: 0 eff: 2414
loadeffect - i: 0 eff: 2416
loadeffect - i: 0 eff: 2418
loadeffect - i: 0 eff: 2420
loadeffect - i: 0 eff: 2422
error:
error:
error:
error:
loadeffect - i: 0 eff: 2424
loadeffect - i: 1 eff: 2426
loadeffect - i: 2 eff: 2428
loadeffect - i: 3 eff: 2430
Loading Music: Media/sounds/intro.mp3
Status: 0
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
Loading Music: Media/sounds/intro.mp3
Status: 0
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
Loading Music: Media/sounds/intro.mp3
Status: 0
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
Loading Music: Media/sounds/intro.mp3
Status: 0
-applicationWillResignActive   -> pause
[GLB]->PAUSE
-applicationDidEnterBackground -> pause
-applicationWillEnterForeground-> do nothing
-applicationDidBecomeActive    -> unpause
[GLB]->RESUMED
[GLB]->QUIT
Shut down GLB
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
glb is shut down
exit
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

spacefractal

Did you deleted the v10 Xcode project first? If not, it's might still uses v10 code.

In greedy mouse, it's works fine, but sometimes it's might freeze when resume, so not sure it's a issue in glbasic, iOS or just mt code. Not checked why, but it's rare so minor here.

You might try to save only on pause, not on quit.

You should release a full source that can invoke the issue, or it's hard to reproduce it.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

aroldo

Spacefractal and Gernot

Attached is a test Xcode project called "ONResume.zip" that reproduces the pause/Resume/quit issue.
It was compiled using GLB V11, on a MacBook Pro running OS X 10.6, the iPhone 4S is running version 6.0.1

I also attached the GLBasic project including all files, "ONResumeGLBP.zip", in case you want to compile on your computer.

When you start the ONResume on the iPhone it does the following:

  • Display the splash screen " Loading"
  • Then displays the stars
  • Then displays a butterfly flying
  • Plays the music

You can tap on the screen to reposition the butterfly.

If you press the home button the app goes in the background, the music dims and stops.

Once you press the ONResume icon it should resume the application where it was before!, but instead it reload the app.
That is exactly what happens to my game, in this case the player has to restart the game.

Please let me know if I and doing something wrong or it this is a bug.

Here is the XCODE log.

init with frame.
App wants to support retina...
Retina scaleing available: self.contentScaleFactor = 2.000000
desktop backing: 640 x 960
mainScreen: 640x960
glb_notify_screen_size 640x960
slaunch ok
-applicationDidBecomeActive    -> unpause
2013-01-07 00:15:54.924 ONResume[644:907] Application windows are expected to have a root view controller at the end of application launch
timer
rbow
rbow init
Rbow::SetScreen( 640,960)
get accurate timer - 1st call
flip - 1st call
BGRA ext supported
Texture size limit: 4096
init fbo
2D VP
OGRB init [OK]
Cptn
Network
Input
Window mode
Create DXin
reptr
getexe
cd
exepath=curdir= /var/mobile/Applications/5A405DAC-303F-4FC8-AF6D-343E00750238/ONResume.app
shoeboxing...
init gettimer
clear screen
flip
mk2D
finding font...
AudioStreamBasicDescription:  2 ch,  44100 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved
Init Finalized
Loading Music: Media/sounds/intro.mp3
Status: 0
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
Loading Music: Media/sounds/intro.mp3
Status: 0
-applicationWillResignActive   -> pause
[GLB]->PAUSE
pause loop in showscreen/hibernate
-applicationDidEnterBackground -> pause
[GLB]->SAVING
[GLB]->QUIT
Shut down GLB
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
Error enqueuing new buffer: -66632
-applicationWillEnterForeground-> do nothing
-applicationDidBecomeActive    -> unpause
[GLB]->RESUMED
glb is shut down
exit

[attachment deleted by admin]
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

spacefractal

#8
Its a pretty wierd one, but i ran out of time, due its was a morning.

But its seen its possible to access the graphicscards too early and its not ready yet. The crash accour when SHOWSCREEN is called after a resume. So resume also works, but crash on SHOWSCREEN.

That dosent happens in greedy mouse, but I must have waited a little bit.

It's also could been a audio issue, not checked with sound off.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

#9
Its a possible to fix, so its a bug in the code.

Uses AUTOPAUSE TRUE and ALLOWESCAPE FALSE top of your code, and then uses OSPaused=FALSE top on your sub functions to checks if its have been paused or not. That is make sure those functions, that contain graphics commands not to been invoked (due the code was countinue to run after its pause). When you do that, then its might crash. All crashes was actuelly on the SHOWSCREEN command (because the function might still been run finished), not on GLB_ON_RESUME().

Gernot:
There is also a minor bug in SHOWSCREEN as well. Its would been best practical to just skip it when its is in the pause mode have been invoked automatic? Then thoses issues like this one should not been happens.


[attachment deleted by admin]
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

spacefractal

#10
also I got a similar issue with ON_RESUME() in Greedy Mouse as well. I have looked on a freeze bug in the game today.

I do found out the game do simply just freeze when you press the power button (not home) to sleep your tablet (in v1.2) when resumed. Howover I did partically fixed the issue, but sometimes its mgiht still crash when its reeach the SHOWSCREEN command or its does nothing at all (yes wierd).

Because of that I will confirm this as a pretty minor little bug, not major (its a no near a important bug at all). So please move this thread to the bug section.

So I thinks in SHOWSCREEN c++ code, you need to checkout the graphicscards status is aviable or not, else wise you might get a bad GPU access crash. We have not allways control when that happens.

This project is also a good example on the crash. Its can been workaround of the bug, but could been fixed in SHOWSCREEN as well. Hence its a minor one.

Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

aroldo

Spacefractal and Gernot,

thank you for finding my issue.

I know if I swnd my game with this bug it will be rejected by Apple, because the user will
Have to re-launch my game twice after it went on PAUSE (GLB_ONPAUSE).

Reading you replies I want to make sure that my code is correct and is handling the
GLB_ONPAUSE and GLB_ONRESUME correctly?
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

spacefractal

Your code should have works as its was, but its required some extra checks to make sure it's don't acess graphics commands and showscreen. The main function do still run after pause....

Also Apple does not checks for bugs, else wise they should have rejected Greedy Mouse v1.1 which did contain a major crash startup bug (v1.0, v1.2 works fine, dispite the above issue).

I also uploaded a new gbas file to been checked the change.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

aroldo

Spacefractal,

Thank you for your help!

I compiled the my ONResume file with your modifications and it works fine!!!!

I tested on the iPad Mini and on the iPhone 4S and the problem was solved.

:nw:
[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2