talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit ad77f62cf69eb1dd5ca50ec341eead5c01251475
parent 40a7c311bfcad7f7ac5b63fcd29f56cb7a726ec0
Author: Paul <paul@claws-mail.org>
Date:   Fri, 17 Nov 2023 15:27:17 +0000

fix bug 4361, 'Embedding external editor crashes Claws-Mail on Wayland' and a similar crash with the dillo plugin

Diffstat:
Msrc/compose.c | 11++++++-----
Msrc/plugins/dillo/dillo_viewer.c | 7++++++-
2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/compose.c b/src/compose.c @@ -9643,7 +9643,7 @@ static void compose_exec_ext_editor(Compose *compose) return; } - if (compose_get_ext_editor_uses_socket()) { + if (compose_get_ext_editor_uses_socket() && GDK_IS_X11_DISPLAY(gdk_display_get_default())) { #ifndef G_OS_WIN32 /* Only allow one socket */ if (compose->exteditor_socket != NULL) { @@ -9670,10 +9670,11 @@ static void compose_exec_ext_editor(Compose *compose) g_free(tmp); return; #endif /* G_OS_WIN32 */ - } + } else + debug_print("Socket communication with an external editor is only available on X11.\n"); if (compose_get_ext_editor_cmd_valid()) { - if (compose_get_ext_editor_uses_socket()) { + if (compose_get_ext_editor_uses_socket() && GDK_IS_X11_DISPLAY(gdk_display_get_default())) { #ifndef G_OS_WIN32 p = g_strdup(prefs_common_get_ext_editor_cmd()); s = strstr(p, "%w"); @@ -9775,7 +9776,7 @@ static void compose_ext_editor_closed_cb(GPid pid, gint exit_status, gpointer da compose->exteditor_file = NULL; compose->exteditor_pid = INVALID_PID; compose->exteditor_tag = -1; - if (compose->exteditor_socket) { + if (compose->exteditor_socket && GDK_IS_X11_DISPLAY(gdk_display_get_default())) { gtk_widget_destroy(compose->exteditor_socket); compose->exteditor_socket = NULL; } @@ -9886,7 +9887,7 @@ static void compose_set_ext_editor_sensitive(Compose *compose, ext_editor_menu_entries[i], sensitive); } - if (compose_get_ext_editor_uses_socket()) { + if (compose_get_ext_editor_uses_socket() && GDK_IS_X11_DISPLAY(gdk_display_get_default())) { if (sensitive) { if (compose->exteditor_socket) gtk_widget_hide(compose->exteditor_socket); diff --git a/src/plugins/dillo/dillo_viewer.c b/src/plugins/dillo/dillo_viewer.c @@ -1,6 +1,6 @@ /* * Claws Mail -- a GTK based, lightweight, and fast e-mail client - * Copyright (C) 1999-2012 the Claws Mail Team + * Copyright (C) 1999-2023 the Claws Mail Team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -125,6 +125,11 @@ static void dillo_show_mimepart(MimeViewer *_viewer, g_free(viewer->filename); } + if (!GDK_IS_X11_DISPLAY(gdk_display_get_default())) { + debug_print("dillo viewer only works on X11\n"); + return; + } + viewer->filename = procmime_get_tmp_file_name(partinfo); if (!(procmime_get_part(viewer->filename, partinfo) < 0)) {