crash on iOS when re-initializing instance of Urho.Application

The following only happens on iOS (not iOS simulator on the Mac or UWP):

I close the Urho.Application using the Exit() method, then set the value of that instance to null, but when I try to show a new instance of the application using await Urho.Application.Show<T>() the application appears for a few seconds before crashing the Xamarin.Forms app.

Xamarin.Forms 2.3.3.175
UrhoSharp.Forms 1.2.21

Debug output looks like this:
2017-03-09 09:09:00.862 iOS[701:310330] Created 1 worker thread 2017-03-09 09:09:00.872 iOS[701:310330] Added resource package ... 2017-03-09 09:09:00.872 iOS[701:310330] Added resource path ... 2017-03-09 09:09:00.922 iOS[701:310330] Set screen mode 2048x1226 windowed resizable 2017-03-09 09:09:00.935 iOS[701:310330] Initialized input 2017-03-09 09:09:00.935 iOS[701:310330] Initialized user interface 2017-03-09 09:09:00.965 iOS[701:310330] Initialized renderer 2017-03-09 09:09:01.373 iOS[701:310330] Set audio mode 44100 Hz stereo interpolated 2017-03-09 09:09:01.374 iOS[701:310330] Initialized engine Thread finished: <Thread Pool> #11 The thread 'Unknown' (0xb) has exited with code 0 (0x0). Thread finished: <Thread Pool> #5 The thread 'Unknown' (0x5) has exited with code 0 (0x0). 2017-03-09 09:09:22.354 iOS[701:310330] Created 1 worker thread 2017-03-09 09:09:22.357 iOS[701:310330] Added resource package ... 2017-03-09 09:09:22.357 iOS[701:310330] Added resource path ... 2017-03-09 09:09:22.377 iOS[701:310330] Set screen mode 2048x1226 windowed resizable 2017-03-09 09:09:22.378 iOS[701:310330] Initialized input 2017-03-09 09:09:22.379 iOS[701:310330] Initialized user interface 2017-03-09 09:09:22.383 iOS[701:310330] Initialized renderer 2017-03-09 09:09:22.385 iOS[701:310330] Could not initialize audio output 2017-03-09 09:09:22.386 iOS[701:310330] Initialized engine Thread finished: <Thread Pool> #8 The thread 'Unknown' (0x8) has exited with code 0 (0x0). Thread finished: <Thread Pool> #4 The thread 'Unknown' (0x4) has exited with code 0 (0x0). Thread finished: <Thread Pool> #3 The thread 'Unknown' (0x3) has exited with code 0 (0x0). Thread finished: <Thread Pool> #13 The thread 'Unknown' (0xd) has exited with code 0 (0x0). Thread finished: <Thread Pool> #10 The thread 'Unknown' (0xa) has exited with code 0 (0x0). Thread finished: <Thread Pool> #12 The thread 'Unknown' (0xc) has exited with code 0 (0x0). The app has been terminated.

The iOS crash report has the following info:
Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_PROTECTION_FAILURE at 0x000000016fcc7f80 Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0xb Terminating Process: exc handler [0] Triggered by Thread: 0

Answers

  • ManuelCostaManuelCosta PTMember ✭✭

    Hi @BenColeman

    not completely sure if Urho3d / Sharp is well prepared for that in iOS. We always keep the controller "hosting" Urho, kill all resources like textures when you go back in controller stack and pause rendering as if the app was sent to background. You can do this last step by setting Urhoview.Pause

    cheers

  • BenColemanBenColeman USMember ✭✭

    @ManuelCosta Could you elaborate a little more? I'm using Urho.Forms, don't see an option to pause or how to kill resources.

  • ManuelCostaManuelCosta PTMember ✭✭

    Hi @BenColeman

    sorry for the delay, but i did not come to forums for quite a long time.
    Did not notice you were using forms. What i can tell you is that in iOS we do not kill the engine ever and the app is quite stable. Android nature is different and the engine must be prepared to die.
    Ping Egor for help on this topic.

    cheers
    Manuel

  • roesterroester USUniversity ✭✭

    I'm having the exact same problem as the OP.

    Is there a correct way to clean up Urho.Application or UrhoSurface in OnDisappearing(), so when I return to the page the engine and scene still work, or at least can be reinitialized correctly?

Sign In or Register to comment.