Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: Dhind 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.
-
Anything related to actual crashes is Unity's territory. Your NGUI is also very out of date.
-
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.
-
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.