Skip to content

[BUG] Media Element Sample missing handler disconnect #1690

@ne0rrmatrix

Description

@ne0rrmatrix

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

On windows when exiting the program there is a CTD intermittently. This occurs when media is playing in Media Element and you exit the program while it is still running/loaded.

Expected Behavior

Windows should cleanly exit when you click close button.

Steps To Reproduce

  1. Run included sample from this repo.
  2. Navigated to Media Element Page.
  3. Exit program.

Link to public reproduction project repository

https://github.com/CommunityToolkit/Maui

Environment

- .NET MAUI CommunityToolkit: 7.0.1
- .Net Maui Communitytoolkit MediaElement: 3.0.1
- OS: Windows 10.0.19041
- .NET MAUI: 8.0.x

Anything else?

At some point the MediaElement.handler?.DisconnectHandler(); was removed from page unload event. This adds it back and fixes crashes on Windows and most likely fixes memory leaks and other issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions