Skip to content

Commit

Permalink
rename onActionDestroyed to onNotificationDestroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
4rneee committed Feb 23, 2025
1 parent 2069f2c commit 28214e6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/singletons/Toasts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void onActionClosed(NotifyNotification *notif, void * /*userData*/)
g_object_unref(notif);
}

void onActionDestroyed(void *data)
void onNotificationDestroyed(void *data)
{
auto *channelNameHeap = static_cast<QString *>(data);
delete channelNameHeap;
Expand Down Expand Up @@ -355,16 +355,16 @@ void Toasts::sendLibnotify(const QString &channelName,
NotifyNotification *notif = notify_notification_new(
str.toUtf8().constData(), channelTitle.toUtf8().constData(), nullptr);

// this will be freed in onActionDestroyed
// this will be freed in onNotificationDestroyed
auto *channelNameHeap = new QString(channelName);

// we only set onActionDestroyed as free_func in the first action because
// all free_funcs will be called once the notification is destroyed which
// would cause a double-free otherwise
// we only set onNotificationDestroyed as free_func in the first action
// because all free_funcs will be called once the notification is destroyed
// which would cause a double-free otherwise
notify_notification_add_action(notif, OPEN_IN_BROWSER.toUtf8().constData(),
OPEN_IN_BROWSER.toUtf8().constData(),
(NotifyActionCallback)onAction,
channelNameHeap, onActionDestroyed);
channelNameHeap, onNotificationDestroyed);
notify_notification_add_action(
notif, OPEN_PLAYER_IN_BROWSER.toUtf8().constData(),
OPEN_PLAYER_IN_BROWSER.toUtf8().constData(),
Expand Down

0 comments on commit 28214e6

Please sign in to comment.