xamarin / urho

Code to integrate with the Urho3D engine
Other
462 stars 122 forks source link

Attempt to invoke virtual method 'void android.app.Activity.finish()' on a null object reference #91

Closed manuelcosta74 closed 7 years ago

manuelcosta74 commented 8 years ago

Enclosed a project that ends up always crashing. It can taken a wile, though.

It looks like native rendering thread is killed before Dalvik's GC removes its reference

cheers

UrhoTest.zip

Exception

--- End of managed exception stack trace --- java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.Activity.finish()' on a null object reference at org.libsdl.app.SDLActivity.handleNativeExit(SDLActivity.java:170) at org.libsdl.app.SDLSurface$1.run(SDLSurface.java:164) at java.lang.Thread.run(Thread.java:818)

Application Output

... SDL] onDestroy() [SDL] nativeQuit() [art] Explicit concurrent mark sweep GC freed 1595(140KB) AllocSpace objects, 7(206KB) LOS objects, 93% free, 866KB/12MB, paused 765us total 22.910ms [Mono] GC_OLD_BRIDGE num-objects 26 num_hash_entries 42 sccs size 36 init 0.00ms df1 0.18ms sort 0.06ms dfs2 0.20ms setup-cb 0.03ms free-data 0.08ms links 26/26/16/1 dfs passes 94/62 [Mono] GC_MAJOR: (user request) pause 5.72ms, total 5.95ms, bridge 0.00ms major 976K/0K los 45K/0K [art] Explicit concurrent mark sweep GC freed 349(16KB) AllocSpace objects, 0(0B) LOS objects, 93% free, 849KB/12MB, paused 592us total 18.867ms [Mono] GC_OLD_BRIDGE num-objects 25 num_hash_entries 41 sccs size 35 init 0.00ms df1 0.18ms sort 0.05ms dfs2 0.17ms setup-cb 0.02ms free-data 0.06ms links 26/26/16/1 dfs passes 92/61 [Mono] GC_MAJOR: (user request) pause 4.75ms, total 4.96ms, bridge 0.00ms major 976K/0K los 45K/0K [art] Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[28,tid=15253,Native,Thread*=0xb78d0d00,peer=0x22d800e0,"Thread-1832"]

EgorBo commented 8 years ago

@manuelcosta74 thank you for the repro!

EgorBo commented 8 years ago

I've pushed a fix to master, it will be available via nuget soon.

afgranero commented 8 years ago

I still get the very same error using UrhoSharp. I got from NuGet yesterday (version 1.0.410). See this solution (without the Urho package that is too large):

HelloWorld.zip

If you compile and change screen orientation a few times (because this call OnDestroy, OnCreate, OnResume) the error occurs just before OnStart.

Is this fix alrady on NuGet? How I can track fixes from GitHub to NuGet versions?

manuelcosta74 commented 8 years ago

@EgorBo we also continue experiencing this in 1.0.410. Given that this is blocker for apps creating and destroying Activities within their flow of usage, a very special attention should be given to this issue by us all. What changes did you do to assume that the issue was solved?

cheers

EgorBo commented 8 years ago

@manuelcosta74 , @afgranero sorry guys I've pushed wrong *.aar with java SDL. I am rewriting SDLActivity.java in C# in order to get rid of aar. Now it should be fixed (7bc0f9a9f16ef8e4d002e14c2c85c0e5f9fcc9c1), will be available with the next nuget update - at least it's not reproduced with the test projects you provided.

manuelcosta74 commented 8 years ago

@EgorBo this issue is not solved in 1.0.454-beta. It crashes always when to to create it for the second time.

EgorBo commented 7 years ago

Fixed a long time ago with help of Manuel.