Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwurstsalat <mailtrash@posteo.de>2023-06-12 10:09:33 +0300
committerwurstsalat <mailtrash@posteo.de>2023-06-12 10:09:38 +0300
commit85706a802722a2b6d147f0c6408ca383fa772d42 (patch)
treea1c702587195c3fa940a6ca428801d15923065da
parentfcc5504f23f742c6222c830bad1ec08424129f2c (diff)
fix: AvatarSelector: Fix crash on reset
Separate reset() and set_pixbuf() methods to prevent recursion issue Fixes #11563
-rw-r--r--gajim/gtk/avatar_selector.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/gajim/gtk/avatar_selector.py b/gajim/gtk/avatar_selector.py
index 9e46a479c..3dfbc2304 100644
--- a/gajim/gtk/avatar_selector.py
+++ b/gajim/gtk/avatar_selector.py
@@ -117,10 +117,9 @@ class AvatarSelector(Gtk.Box):
app.check_finalize(self)
def reset(self) -> None:
+ self._crop_area.reset()
self._load_button.show()
self._helper_label.show()
- self._crop_area.hide()
- self._crop_area.set_pixbuf(None)
def prepare_crop_area(self, path: str) -> None:
pixbuf = self._get_pixbuf_from_path(path)
@@ -254,13 +253,11 @@ class CropArea(Gtk.DrawingArea):
else:
self._aspect = -1
- def set_pixbuf(self, pixbuf: GdkPixbuf.Pixbuf | None) -> None:
- if pixbuf is None:
- self._browse_pixbuf = None
- avatar_selector = cast(AvatarSelector, self.get_parent())
- avatar_selector.reset()
- return
+ def reset(self) -> None:
+ self._browse_pixbuf = None
+ self.hide()
+ def set_pixbuf(self, pixbuf: GdkPixbuf.Pixbuf) -> None:
self._browse_pixbuf = pixbuf
width = pixbuf.get_width()
height = pixbuf.get_height()
@@ -306,9 +303,10 @@ class CropArea(Gtk.DrawingArea):
self._update_pixbufs()
if self._pixbuf is None:
+ avatar_selector = cast(AvatarSelector, self.get_parent())
+ avatar_selector.reset()
ErrorDialog(_('Error Loading Image'),
_('Selected image could not be loaded.'))
- self.set_pixbuf(None)
return False
width = self._pixbuf.get_width()