Skip to content

Commit f219567

Browse files
committed
[email protected] - Avoid redundant update_list calls during clear all.
1 parent 1898e91 commit f219567

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

files/usr/share/cinnamon/applets/[email protected]/applet.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,15 @@ class CinnamonNotificationsApplet extends Applet.TextIconApplet {
243243
}
244244

245245
_clear_all() {
246-
let count = this.notifications.length;
247-
if (count > 0) {
248-
for (let i = count-1; i >=0; i--) {
249-
this._notificationbin.remove_actor(this.notifications[i].actor);
250-
this.notifications[i].destroy(NotificationDestroyedReason.DISMISSED);
251-
}
252-
}
246+
let toDestroy = this.notifications.slice();
247+
248+
// Clear tracking state first so destroy handlers skip redundant work.
253249
this.notifications = [];
250+
this._notificationbin.remove_all_children();
251+
252+
for (let notification of toDestroy) {
253+
notification.destroy(NotificationDestroyedReason.DISMISSED);
254+
}
254255
this.update_list();
255256
}
256257

0 commit comments

Comments
 (0)