Commit c9f2d498 authored by Giovanni Panozzo's avatar Giovanni Panozzo

Fix a couple of VNCI crashes, see issue #1821

parent a759c48f
......@@ -3572,7 +3572,7 @@ static RemminaConnectionWindow* remmina_connection_window_find(RemminaFile* remm
static gboolean remmina_connection_object_delayed_window_present(gpointer user_data)
{
RemminaConnectionObject* cnnobj = (RemminaConnectionObject*)user_data;
if (cnnobj && cnnobj->cnnhld && cnnobj->cnnhld->cnnwin) {
if (cnnobj && cnnobj->connected && cnnobj->cnnhld && cnnobj->cnnhld->cnnwin) {
gtk_window_present_with_time(GTK_WINDOW(cnnobj->cnnhld->cnnwin), (guint32)(g_get_monotonic_time() / 1000));
remmina_connection_holder_grab_focus(GTK_NOTEBOOK(cnnobj->cnnhld->cnnwin->priv->notebook));
}
......
......@@ -82,6 +82,9 @@ static gboolean remmina_masterthread_exec_callback(RemminaMTExecData *d)
case FUNC_PROTOCOLWIDGET_MPSHOWRETRY:
remmina_protocol_widget_panel_show_retry(d->p.protocolwidget_mpshowretry.gp);
break;
case FUNC_PROTOCOLWIDGET_PANELSHOWLISTEN:
remmina_protocol_widget_panel_show_listen(d->p.protocolwidget_panelshowlisten.gp, d->p.protocolwidget_panelshowlisten.port);
break;
case FUNC_SFTP_CLIENT_CONFIRM_RESUME:
#ifdef HAVE_LIBSSH
d->p.sftp_client_confirm_resume.retval = remmina_sftp_client_confirm_resume( d->p.sftp_client_confirm_resume.client,
......
......@@ -50,6 +50,7 @@ typedef struct remmina_masterthread_exec_data {
FUNC_PROTOCOLWIDGET_MPPROGRESS,
FUNC_PROTOCOLWIDGET_MPDESTROY,
FUNC_PROTOCOLWIDGET_MPSHOWRETRY,
FUNC_PROTOCOLWIDGET_PANELSHOWLISTEN,
FUNC_VTE_TERMINAL_SET_ENCODING_AND_PTY
} func;
......@@ -96,6 +97,10 @@ typedef struct remmina_masterthread_exec_data {
struct {
RemminaProtocolWidget *gp;
} protocolwidget_mpshowretry;
struct {
RemminaProtocolWidget *gp;
int port;
} protocolwidget_panelshowlisten;
#ifdef HAVE_LIBSSH
struct {
RemminaSFTPClient *client;
......
......@@ -1490,6 +1490,18 @@ void remmina_protocol_widget_panel_show_listen(RemminaProtocolWidget* gp, gint p
RemminaMessagePanel *mp;
gchar* s;
if ( !remmina_masterthread_exec_is_main_thread() ) {
/* Allow the execution of this function from a non main thread */
RemminaMTExecData *d;
d = (RemminaMTExecData*)g_malloc( sizeof(RemminaMTExecData) );
d->func = FUNC_PROTOCOLWIDGET_PANELSHOWLISTEN;
d->p.protocolwidget_panelshowlisten.gp = gp;
d->p.protocolwidget_panelshowlisten.port = port;
remmina_masterthread_exec_and_wait(d);
g_free(d);
return;
}
mp = remmina_message_panel_new();
s = g_strdup_printf(
_("Listening on port %i for an incoming %s connection…"), port,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment