Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  App crash after RemoveFromSolver called [4.0.2 and older]
#8
Created an account for this Sonrisa

Sorry for a necro, but I've encountered the same problem in v3.5.
I manually add/remove solvers to/from the solver and with enough calls, without the multiple-unpin check, I start corrupting the engine itself
I.E. I'll start losing references to assets, some shaders might go magenta etc until it eventually hard-crashes.

In total I've changed the following in Oni.cs:
Code:
    static List<GCHandle> _AllUnpinnedHandles = new List<GCHandle>();

    public static GCHandle PinMemory(object data){
        GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);

        if(_AllUnpinnedHandles.Contains(handle))
        {
            Debug.LogError("Unpinned handle generated by Alloc??");
            _AllUnpinnedHandles.Remove(handle);
        }

        return handle;
    }

    public static void UnpinMemory(GCHandle handle){

        if(handle.IsAllocated && _AllUnpinnedHandles.Contains(handle))
        {
            Debug.LogError("Trying to UnpinMemory for already unpinned handler");
            return;
        }

        if(handle.IsAllocated)
        {
            _AllUnpinnedHandles.Add(handle);

            handle.Free();
        }
    }
I'm getting the 1st LogError in ObiClothBase.GetMeshDataArrays and in ObiCloth.AddToSolver, while the 2nd error appears only in GetMeshDataArrays.
Note that looking at message counts, they are not 1:1, and some messages come in from the OnEnable() call in ObiCloth, while others come from AddToSolver directly.

Not sure what causes the crash specifically, but the check in Unpin deffinitely prevents it, and there doesn't seem to be any leakage caused by it, at least nothing Task Manager can find.
Reply


Messages In This Thread
RE: App crash after RemoveFromSolver called [4.0.2 and older] - by ThoughtMango - 28-03-2019, 10:38 AM