aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2025-11-07 12:52:48 -0500
committerfiaxh <git@lightrise.org>2025-11-13 05:16:18 -0600
commit68b07ef13c857b07d32c2fd8da08a0660f961a0a (patch)
tree051a65592cc6a47c7a592c3299f0261d7d7e535f /main/src
parente67b0807d4afd283bcab1acfcb083b3b0e111dd8 (diff)
Fix file overlay leak
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_view.vala22
-rw-r--r--main/src/ui/conversation_view_controller.vala4
-rw-r--r--main/src/ui/file_send_overlay.vala22
3 files changed, 23 insertions, 25 deletions
diff --git a/main/src/ui/conversation_view.vala b/main/src/ui/conversation_view.vala
index 128b3bd8..62d1ec9b 100644
--- a/main/src/ui/conversation_view.vala
+++ b/main/src/ui/conversation_view.vala
@@ -16,6 +16,7 @@ public class ConversationView : Widget {
[GtkChild] public unowned ChatInput.View chat_input;
[GtkChild] public unowned ConversationSummary.ConversationView conversation_frame;
[GtkChild] public unowned Revealer white_revealer;
+ [GtkChild] public unowned Revealer content_revealer;
public ListView list_view = new ListView(null, null);
@@ -31,24 +32,25 @@ public class ConversationView : Widget {
}
public void add_overlay_dialog(Widget widget) {
- Revealer revealer = new Revealer() { transition_type=RevealerTransitionType.CROSSFADE , transition_duration= 100 };
- revealer.set_child(widget);
+ content_revealer.set_child(widget);
- overlay.add_overlay(revealer);
-
- revealer.reveal_child = true;
+ content_revealer.visible = true;
+ content_revealer.reveal_child = true;
white_revealer.visible = true;
white_revealer.reveal_child = true;
- widget.destroy.connect(() => {
- overlay.remove_overlay(revealer);
- white_revealer.reveal_child = false;
- chat_input.do_focus();
- });
+ }
+
+ public void remove_overlay_dialog() {
+ white_revealer.reveal_child = false;
+ content_revealer.reveal_child = false;
+ chat_input.do_focus();
}
private void on_child_revealed_changed() {
if (!white_revealer.child_revealed) {
white_revealer.visible = false;
+ content_revealer.visible = false;
+ content_revealer.set_child(null);
}
}
}
diff --git a/main/src/ui/conversation_view_controller.vala b/main/src/ui/conversation_view_controller.vala
index 2e11e1e9..888879b0 100644
--- a/main/src/ui/conversation_view_controller.vala
+++ b/main/src/ui/conversation_view_controller.vala
@@ -230,7 +230,7 @@ public class ConversationViewController : Object {
}
}
if (!something_works && limits.has_key(0)) {
- if (!something_works && file_info.get_size() > limits[0]) {
+ if (!something_works && file_info.get_size() > limits[0] && overlay != null) {
overlay.set_file_too_large();
}
}
@@ -238,8 +238,10 @@ public class ConversationViewController : Object {
overlay.close.connect(() => {
// We don't want drag'n'drop to be active while the overlay is active
+ view.remove_overlay_dialog();
overlay_dialog = null;
update_file_upload_status.begin();
+ overlay = null;
});
view.add_overlay_dialog(overlay.get_widget());
diff --git a/main/src/ui/file_send_overlay.vala b/main/src/ui/file_send_overlay.vala
index d8a6ba6b..45349c11 100644
--- a/main/src/ui/file_send_overlay.vala
+++ b/main/src/ui/file_send_overlay.vala
@@ -6,16 +6,16 @@ using Dino.Entities;
namespace Dino.Ui {
-public class FileSendOverlay {
+public class FileSendOverlay : Object {
public signal void close();
public signal void send_file();
public Box main_box;
- public Button close_button;
- public Button send_button;
- public SizingBin file_widget_insert;
- public Label info_label;
+ public unowned Button close_button;
+ public unowned Button send_button;
+ public unowned SizingBin file_widget_insert;
+ public unowned Label info_label;
private bool can_send = true;
@@ -28,11 +28,11 @@ public class FileSendOverlay {
info_label = (Label) builder.get_object("info_label");
close_button.clicked.connect(() => {
- do_close();
+ close();
});
send_button.clicked.connect(() => {
send_file();
- do_close();
+ close();
});
load_file_widget.begin(file, file_info);
@@ -48,7 +48,7 @@ public class FileSendOverlay {
var key_events = new EventControllerKey();
key_events.key_pressed.connect((keyval) => {
if (keyval == Gdk.Key.Escape) {
- do_close();
+ close();
}
return false;
});
@@ -87,12 +87,6 @@ public class FileSendOverlay {
can_send = false;
}
- private void do_close() {
- this.close();
- main_box.unparent();
- main_box.destroy();
- }
-
public Widget get_widget() {
return main_box;
}