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

fix: don't do self-destroy in LibnotifyNotification::Dismiss() #41691

Merged
merged 1 commit into from Mar 27, 2024

Conversation

taoky
Copy link
Contributor

@taoky taoky commented Mar 25, 2024

Description of Change

Callers of Notification::Dismiss() assume that the notification instance is not deleted after the call, but this was not the case for LibnotifyNotification:

  • Destroy() would get this deleted.
  • notify_notification_close() in portal environment triggers LibnotifyNotification::OnNotificationClosed(), and finally calls Destroy()

This patch removes all Destroy() in Dismiss(), and adds a boolean to tell whether notify_notification_close() is running, to avoid crash under portal environment.

Fixes #40461.

Checklist

Release Notes

Notes: Fixed crash in Notification::Close() under libnotify 0.8.x with portal environment.

Callers of Notification::Dismiss() assume that the notification
instance is not deleted after the call, but this was not the case
for LibnotifyNotification:
- Destroy() would get `this` deleted.
- notify_notification_close() in portal environment triggers
LibnotifyNotification::OnNotificationClosed(), and finally calls
Destroy()

This patch removes all Destroy() in Dismiss(), and adds a boolean
to tell whether notify_notification_close() is running, to avoid crash
under portal environment.

Fixes electron#40461.
Copy link

welcome bot commented Mar 25, 2024

💖 Thanks for opening this pull request! 💖

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Mar 25, 2024
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ckerr ckerr added semver/patch backwards-compatible bug fixes 29-x-y target/30-x-y PR should also be added to the "30-x-y" branch. labels Mar 26, 2024
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Mar 26, 2024
@ckerr ckerr added target/27-x-y PR should also be added to the "27-x-y" branch. target/28-x-y PR should also be added to the "28-x-y" branch. target/29-x-y PR should also be added to the "29-x-y" branch. and removed 29-x-y labels Mar 26, 2024
@codebytere codebytere merged commit 4f76fff into electron:main Mar 27, 2024
33 checks passed
Copy link

welcome bot commented Mar 27, 2024

Congrats on merging your first pull request! 🎉🎉🎉

Copy link

release-clerk bot commented Mar 27, 2024

Release Notes Persisted

Fixed crash in Notification::Close() under libnotify 0.8.x with portal environment.

@trop
Copy link
Contributor

trop bot commented Mar 27, 2024

I was unable to backport this PR to "27-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Mar 27, 2024

I have automatically backported this PR to "29-x-y", please check out #41707

@trop
Copy link
Contributor

trop bot commented Mar 27, 2024

I have automatically backported this PR to "30-x-y", please check out #41708

@trop
Copy link
Contributor

trop bot commented Mar 27, 2024

I have automatically backported this PR to "28-x-y", please check out #41709

@trop trop bot added in-flight/28-x-y and removed target/29-x-y PR should also be added to the "29-x-y" branch. target/30-x-y PR should also be added to the "30-x-y" branch. target/28-x-y PR should also be added to the "28-x-y" branch. labels Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/28-x-y PR was merged to the "28-x-y" branch. merged/29-x-y PR was merged to the "29-x-y" branch. merged/30-x-y PR was merged to the "30-x-y" branch. semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Electron crashes with libnotify 0.8.3 in portal environment when closing notification
4 participants