[fractal/fractal-next] media-viewer: Fix race condition
- From: Julian Sparber <jsparber src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [fractal/fractal-next] media-viewer: Fix race condition
- Date: Wed, 1 Dec 2021 10:41:20 +0000 (UTC)
commit 59273a7b86614206a16961b8c4e796fe80c01a4e
Author: Kévin Commaille <zecakeh tedomum fr>
Date: Wed Dec 1 11:32:36 2021 +0100
media-viewer: Fix race condition
It would cause a crash if the menu popover wasn't set yet.
data/resources/ui/media-viewer.ui | 1 -
src/session/media_viewer.rs | 4 +++-
2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/data/resources/ui/media-viewer.ui b/data/resources/ui/media-viewer.ui
index c470ae48..a3bccafb 100644
--- a/data/resources/ui/media-viewer.ui
+++ b/data/resources/ui/media-viewer.ui
@@ -71,7 +71,6 @@
<child type="end">
<object class="GtkMenuButton" id="menu_full">
<property name="icon-name">view-more-symbolic</property>
- <property name="menu-model" bind-source="MediaViewer" bind-property="context-menu"
bind-flags="sync-create"/>
</object>
</child>
<child type="end">
diff --git a/src/session/media_viewer.rs b/src/session/media_viewer.rs
index aaa84659..839585df 100644
--- a/src/session/media_viewer.rs
+++ b/src/session/media_viewer.rs
@@ -109,7 +109,9 @@ mod imp {
fn constructed(&self, obj: &Self::Type) {
self.parent_constructed(obj);
- obj.set_context_menu(Some(Self::Type::event_menu_model()));
+ let menu_model = Some(Self::Type::event_menu_model());
+ self.menu_full.set_menu_model(menu_model.as_ref());
+ obj.set_context_menu(menu_model);
// Bind `fullscreened` to the window property of the same name.
obj.connect_notify_local(Some("root"), |obj, _| {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]