[gnome-sound-recorder] Fix export dialog that disappears
- From: Bilal Elmoussaoui <bilelmoussaoui src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-sound-recorder] Fix export dialog that disappears
- Date: Mon, 25 Jan 2021 18:50:28 +0000 (UTC)
commit e1559c258b7ccc4771bc126fa77b65f65f16659a
Author: Sergio Costas <raster rastersoft com>
Date: Sat Nov 7 22:56:36 2020 +0100
Fix export dialog that disappears
When pressing the EXPORT button, the file dialog randomly
disappears before being able to specify a place where to store
the file. This is because the Gtk.FileChooser dialog is stored
in a local variable, which, as soon as the callback where it is
created returns, becomes unreferenced, and is reclaimed by the
garbage collector (which happens at random intervals). This
bug can be reproduced just by recording something, pressing
the "export" button, and waiting.
This patch fixes it by storing the dialog as a property in the
row object.
Fix https://gitlab.gnome.org/GNOME/gnome-sound-recorder/-/merge_requests/164
src/row.js | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/row.js b/src/row.js
index 154c0ef..743de63 100644
--- a/src/row.js
+++ b/src/row.js
@@ -68,16 +68,17 @@ var Row = GObject.registerClass({
let exportAction = new Gio.SimpleAction({ name: 'export' });
exportAction.connect('activate', () => {
const window = Gio.Application.get_default().get_active_window();
- const dialog = Gtk.FileChooserNative.new(_('Export Recording'), window,
Gtk.FileChooserAction.SAVE, _('_Export'), _('_Cancel'));
- dialog.set_current_name(`${this._recording.name}.${this._recording.extension}`);
- dialog.connect('response', (_dialog, response) => {
+ this.exportDialog = Gtk.FileChooserNative.new(_('Export Recording'), window,
Gtk.FileChooserAction.SAVE, _('_Export'), _('_Cancel'));
+ this.exportDialog.set_current_name(`${this._recording.name}.${this._recording.extension}`);
+ this.exportDialog.connect('response', (_dialog, response) => {
if (response === Gtk.ResponseType.ACCEPT) {
- const dest = dialog.get_file();
+ const dest = this.exportDialog.get_file();
this._recording.save(dest);
}
- dialog.destroy();
+ this.exportDialog.destroy();
+ this.exportDialog = null;
});
- dialog.show();
+ this.exportDialog.show();
});
this.actionGroup.add_action(exportAction);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]