Skip to content

Commit 4d14dbc

Browse files
committed
Fix: Prevent image grid idle callback log spam in the clipboard module.
1 parent 65cfd00 commit 4d14dbc

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

gnome-extensions/extension/features/Clipboard/view/clipboardGridItemFactory.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,19 @@ export class ClipboardGridItemFactory {
344344
y_expand: true,
345345
});
346346

347-
GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
347+
let imageStyleIdleId = GLib.idle_add(GLib.PRIORITY_DEFAULT_IDLE, () => {
348+
imageStyleIdleId = 0;
348349
if (imageWrapper.get_stage()) {
349350
imageWrapper.set_style(`background-image: url('file://${imagePath}'); background-size: cover;`);
350351
}
351352
return GLib.SOURCE_REMOVE;
352353
});
354+
imageWrapper.connect('destroy', () => {
355+
if (imageStyleIdleId) {
356+
GLib.source_remove(imageStyleIdleId);
357+
imageStyleIdleId = 0;
358+
}
359+
});
353360

354361
return imageWrapper;
355362
}

0 commit comments

Comments
 (0)