Philipp Hörist pushed to branch master at gajim / gajim
Commits:
d88b4fb9 by Philipp Hörist at 2025-08-11T21:32:51+02:00
fix: Preview: Update widget in the main thread
- - - - -
1 changed file:
- gajim/common/preview.py
Changes:
=====================================
gajim/common/preview.py
=====================================
@@ -368,14 +368,16 @@ def create_thumbnail(self, preview: Preview, data: bytes)
-> None:
preview.size,
preview.mime_type,
)
- future.add_done_callback(partial(self._write_thumbnail, preview))
+ future.add_done_callback(
+ partial(GLib.idle_add, self._write_thumbnail, preview)
+ )
except Exception as error:
preview.info_message = _('Creating thumbnail failed')
preview.update_widget()
log.warning('Creating thumbnail failed for: %s %s',
preview.orig_path, error)
- def _write_thumbnail(self, preview: Preview, future: Future[bytes | None])
-> None:
+ def _write_thumbnail(self, preview: Preview, future: Future[bytes | None])
-> bool:
try:
result = future.result()
if result is None:
@@ -385,7 +387,7 @@ def _write_thumbnail(self, preview: Preview, future:
Future[bytes | None]) -> No
preview.update_widget()
log.warning('Creating thumbnail failed for: %s %s',
preview.orig_path, error)
- return
+ return GLib.SOURCE_REMOVE
preview.thumbnail = result
@@ -395,6 +397,8 @@ def _write_thumbnail(self, preview: Preview, future:
Future[bytes | None]) -> No
self._on_thumb_write_finished,
preview)
+ return GLib.SOURCE_REMOVE
+
def _process_web_uri(self,
uri: str,
widget: Any,
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d88b4fb9f440d9f991655a65e8758e90f18c24db
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/d88b4fb9f440d9f991655a65e8758e90f18c24db
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]