Codebase list gnome-sound-recorder / e1559c2
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 Sergio Costas authored 3 years ago Bilal Elmoussaoui committed 3 years ago
1 changed file(s) with 7 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
6767 let exportAction = new Gio.SimpleAction({ name: 'export' });
6868 exportAction.connect('activate', () => {
6969 const window = Gio.Application.get_default().get_active_window();
70 const dialog = Gtk.FileChooserNative.new(_('Export Recording'), window, Gtk.FileChooserAction.SAVE, _('_Export'), _('_Cancel'));
71 dialog.set_current_name(`${this._recording.name}.${this._recording.extension}`);
72 dialog.connect('response', (_dialog, response) => {
70 this.exportDialog = Gtk.FileChooserNative.new(_('Export Recording'), window, Gtk.FileChooserAction.SAVE, _('_Export'), _('_Cancel'));
71 this.exportDialog.set_current_name(`${this._recording.name}.${this._recording.extension}`);
72 this.exportDialog.connect('response', (_dialog, response) => {
7373 if (response === Gtk.ResponseType.ACCEPT) {
74 const dest = dialog.get_file();
74 const dest = this.exportDialog.get_file();
7575 this._recording.save(dest);
7676 }
77 dialog.destroy();
77 this.exportDialog.destroy();
78 this.exportDialog = null;
7879 });
79 dialog.show();
80 this.exportDialog.show();
8081 });
8182 this.actionGroup.add_action(exportAction);
8283