Author Topic: Odd crash. Any ideas?  (Read 5136 times)

Dhind

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Odd crash. Any ideas?
« on: June 10, 2015, 07:27:22 PM »
We got a crash with this callstack (NGUI 3.5.6). Any ideas?:

1   libsystem_kernel.dylib   __pthread_kill + 8
2   libsystem_pthread.dylib   pthread_kill + 108
3   libsystem_c.dylib   abort + 108
4   cb   GC_stop_world (darwin_stop_world.c:569)
5   cb   GC_stopped_mark (alloc.c:611)
6   cb   GC_try_to_collect_inner (alloc.c:460)
7   cb   GC_collect_or_expand (alloc.c:1264)
8   cb   GC_allocobj (alloc.c:1353)
9   cb   GC_generic_malloc_inner (malloc.c:133)
10   cb   GC_generic_malloc (malloc.c:182)
11   cb   GC_malloc (malloc.c:287)
12   cb   il2cpp::vm::Object::Clone(Il2CppObject*) + 40
13   cb   MulticastDelegate_RemoveImpl_m22652 (GeneratedVirtualInvokers.h:20)
14   cb   UIAnchor_OnDestroy_m10577 (Bulk_Assembly-CSharp_9.cpp:4076)
15   cb   RuntimeInvoker_Void_t471(MethodInfo*, void*, void**) (GeneratedInvokers.cpp:12)
16   cb   il2cpp::vm::Runtime::Invoke(MethodInfo*, void*, void**, Il2CppObject**) + 64
17   cb   ScriptingInvocation::Invoke(ScriptingException**, bool) (ScriptingInvocation.cpp:128)
18   cb   ScriptingInvocationNoArgs::InvokeChecked() (ScriptingInvocationNoArgs.cpp:83)
19   cb   MonoBehaviour::CallMethodInactive(ScriptingMethodIl2Cpp) (MonoBehaviour.cpp:370)
20   cb   Unity::GameObject::WillDestroyGameObject() (GameObject.cpp:84)
21   cb   PreDestroyRecursive(Unity::GameObject&, unsigned long*) (GameObjectUtility.cpp:1222)
22   cb   DestroyGameObjectHierarchy(Unity::GameObject&) (GameObjectUtility.cpp:1287)
23   cb   DestroyObjectHighLevel(Object*, bool) (GameObjectUtility.cpp:1447)
24   cb   CleanupAllObjects(bool) (SaveAndLoadHelper.cpp:298)
25   cb   CleanupEngine() (SaveAndLoadHelper.cpp:450)
26   cb   PlayerCleanup(bool, bool) (Player.cpp:1162)
27   cb   UnityCleanup (LibEntryPoint.mm:237)
28   UIKit   -[UIApplication _terminateWithStatus:] + 192

This was on IOS. The crash involved UIAnchor_OnDestroy (although I'm not certain ngui was the culprit). Thanks.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Odd crash. Any ideas?
« Reply #1 on: June 11, 2015, 06:42:32 AM »
Anything related to actual crashes is Unity's territory. Your NGUI is also very out of date.

iamdain

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 2
    • View Profile
Re: Odd crash. Any ideas?
« Reply #2 on: January 07, 2016, 09:06:29 PM »
We had this same trace on a crash, you can see a UIAnchor call in the middle.

For us it was triggered by the OnDestroy function in UIAnchor where it tries to de-reference the delegated method for onScreenResize.

This static delegate is assigned on Awake of every instance of UIAnchor and de-referenced on every Destroy.

We have multiple NGUI hierarchies being created / destroyed and after inspecting we found our game often ends up in a state where there is no referenced method and it appears that on quitting the app the attempt to de-reference the method throws the error.

I'm not sure why an exception is not thrown within the app  (surely we were triggering the OnDestroy method while the delegate pointed to null in several other places though it didn't cause a problem). It only seems a problem when OnDestroy is triggered on app close. Not sure if that makes it a Unity or NGUI problem, for now we've had to tweak the NGUI code to handle this case.

In any case it seems NGUI should be changed to account for use of multiple instances of UIAnchor - a single static var is being used to track a state which should be per-instance, what do you think Aren? We're on current version NGUI btw.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Odd crash. Any ideas?
« Reply #3 on: January 09, 2016, 10:37:51 AM »
Try changing UIAnchor's Awake() and OnDestroy() functions to OnEnable() and OnDisable(), respectively. Also note that UIAnchor has been deprecated for quite a while as its functionality can all be done with a UIWidget.