Fix crash when adding an external editor

On some platforms, the app chooser dialog causes a crash after selecting
an application. The application information returned by the dialog may
also trigger crashes when accessed. See
https://gitlab.gnome.org/GNOME/glib/-/issues/1104 and
https://gitlab.gnome.org/GNOME/glibmm/-/issues/94. This commit overrides
gtkmm's app chooser dialog to work around these bugs.
This commit is contained in:
Lawrence Lee
2021-08-14 16:05:11 -07:00
parent 9423ebc97c
commit d3e524a491
7 changed files with 130 additions and 10 deletions

View File

@@ -18,7 +18,6 @@
*/
#pragma once
#include <gtkmm/appchooserdialog.h>
#include <gtkmm/button.h>
#include <gtkmm/box.h>
#include <gtkmm/liststore.h>
@@ -26,6 +25,8 @@
#include <gtkmm/treemodelcolumn.h>
#include <gtkmm/treeview.h>
#include "rtappchooserdialog.h"
/**
* Widget for editing the external editors options.
@@ -98,7 +99,7 @@ private:
Gtk::Button *button_app_chooser;
Gtk::Button *button_add;
Gtk::Button *button_remove;
std::unique_ptr<Gtk::AppChooserDialog> app_chooser_dialog;
std::unique_ptr<RTAppChooserDialog> app_chooser_dialog;
/**
* Inserts a new editor entry after the current selection, or at the end if
@@ -117,7 +118,7 @@ private:
* Called when the user is done interacting with the app chooser dialog.
* Closes the dialog and updates the selected entry if an app was chosen.
*/
void onAppChooserDialogResponse(int responseId, Gtk::AppChooserDialog *dialog);
void onAppChooserDialogResponse(int responseId, RTAppChooserDialog *dialog);
/**
* Shows the app chooser dialog.
*/