From 80b3da418bb8d5ae7a925509935a41f3ae316e5e Mon Sep 17 00:00:00 2001 From: szymon Date: Wed, 30 Sep 2026 15:15:15 +0200 Subject: [PATCH] feat: add drop trait for notification --- src/notification.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/notification.rs b/src/notification.rs index 510ccc5..abee4f9 100644 --- a/src/notification.rs +++ b/src/notification.rs @@ -316,6 +316,16 @@ impl<'a> Notification { } } +impl Drop for Notification { + fn drop(&mut self) { + if self.inner.is_null() { + return; // shouldn't happen, but check just in case + } + + unsafe { g_object_unref(self.inner as *mut std::os::raw::c_void) }; + } +} + unsafe extern "C" fn action_trampoline( _notification: *mut NotifyNotification, action: *mut ::std::os::raw::c_char,