Skip to content

Prevent disposing on wrong threads #67

@SupinePandora43

Description

@SupinePandora43
  1. Set IsDisposed on this to true
  2. GC.SupressFinalize(this)
  3. Add (Type, Handle) to ThreadLocal<List<Type, nuint>> ToDispose

Checkthread function:

if(!ToDispose.Value.IsEmpty){
    for((type, ptr) in ToDispose.Value)
        type switch
        {
            typeof(View) => Methods.ulDestroyView((Handle<View>)ptr),
            _ => throw new OutOfRangeException()
        };
    ToDispose.Value.Clear(); // make sure it cleans up internal array
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions