Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent disposing on wrong threads #67

Open
Tracked by #60
SupinePandora43 opened this issue Sep 3, 2022 · 1 comment
Open
Tracked by #60

Prevent disposing on wrong threads #67

SupinePandora43 opened this issue Sep 3, 2022 · 1 comment

Comments

@SupinePandora43
Copy link
Owner

  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
}
@SupinePandora43
Copy link
Owner Author

Multithreading improvements promised to come in ultralight 1.4

@SupinePandora43 SupinePandora43 added this to the Ultralight 1.4 milestone Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant