Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Drop of COM class not working in webview2 example? #202

@AndyT-MS

Description

@AndyT-MS

I'm getting a panic when running examples/webview2.rs because environment still has a strong ref count of 2 at the point of calling try_unwrap on it, despite the explicit call to drop(handler_class) earlier. The first line in the below output is a debug println! that I added to display Arc::strong_count(&environment) and Arc::weak_count(&environment) just before the try_unwrap call and after the drop(handler_class) call.

Strong: 2  Weak: 0
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Mutex { data: None }'

Although I'm generally calling the real WebView2Loader.dll in my code, the error repros without it. I still get it when I comment out the whole call to CreateCoreWebView2Environment on line 77, and that's why data == None in the above output rather than an actual object.

Is this a bug in the generated Drop implementation for CreateCoreWebView2EnvironmentCompletedHandler? It's also possible that I'm just missing something that should be reasonably obvious because I'm still very new to Rust.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions