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

@@ -39,6 +39,7 @@
#include "procparamchangers.h"
#include "placesbrowser.h"
#include "pathutils.h"
#include "rtappchooserdialog.h"
#include "thumbnail.h"
#include "toolpanelcoord.h"
@@ -2014,7 +2015,7 @@ void EditorPanel::sendToExternalPressed()
{
if (options.externalEditorIndex == -1) {
// "Other" external editor. Show app chooser dialog to let user pick.
Gtk::AppChooserDialog *dialog = getAppChooserDialog();
RTAppChooserDialog *dialog = getAppChooserDialog();
dialog->show();
} else {
struct ExternalEditor editor = options.externalEditors.at(options.externalEditorIndex);
@@ -2195,10 +2196,10 @@ bool EditorPanel::idle_sentToGimp (ProgressConnector<int> *pc, rtengine::IImagef
return false;
}
Gtk::AppChooserDialog *EditorPanel::getAppChooserDialog()
RTAppChooserDialog *EditorPanel::getAppChooserDialog()
{
if (!app_chooser_dialog.get()) {
app_chooser_dialog.reset(new Gtk::AppChooserDialog("image/tiff"));
app_chooser_dialog.reset(new RTAppChooserDialog("image/tiff"));
app_chooser_dialog->signal_response().connect(
sigc::mem_fun(*this, &EditorPanel::onAppChooserDialogResponse)
);