Skip to content

Snackbar with Message Box throws error in newer versions #2627

Closed

Description

@SilentSammy

After version 3.1.3, if a snackbar's action is set to display a message box, and that message box is closed after the snackbar closes, the application will throw a "System.ObjectDisposedException: 'Safe handle has been closed'" exception.

Step 1
image

Step 2
image

Step 3
image

Step 4 (After closing the message box)
image

This exception is only thrown on versions after 3.1.3.
Maybe it's possible to add a bool argument to Enqueue() or a MessageQueue property to execute the older code?

Here's the link to the test app's repo: https://github.com/SilentSammy/SnackbarBug
Also attached is the project as a zip file just in case: SnackbarBug.zip

Activity

  1. Erapchu commented on Mar 31, 2022

    @Erapchu
    Contributor

    There's an error in code @Keboo
    SnackbarMessageQueue => CreateAndShowMessage => anonymous delegate snackbarMessage.ActionClick subscribe.
    We dispose EventWaitHandle after some time and then call .Set() method on it - it's unsafe and application may shutdown immediately.
    At least I suggest to add this check

    if (++clickCount == 1)
        DoActionCallback(messageQueueItem);
    if (actionClickWaitHandle.SafeWaitHandle.IsInvalid || actionClickWaitHandle.SafeWaitHandle.IsClosed)
        return;
    actionClickWaitHandle.Set();
    
  2. added this to the 4.5.0 milestone on Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions