Commit b3ed3636 authored by Simon Morlat's avatar Simon Morlat Committed by Sandrine Avakian

fix crash on windows when moving the video window frequently

parent 74a5945a
......@@ -121,7 +121,7 @@ static void _resize_video_window(GtkWidget *video_window, MSVideoSize vsize){
}
}
static gint resize_video_window(LinphoneCall *call){
static gboolean resize_video_window(LinphoneCall *call){
const LinphoneCallParams *params=linphone_call_get_current_params(call);
if (params){
MSVideoSize vsize=linphone_call_params_get_received_video_size(params);
......@@ -232,6 +232,18 @@ static gboolean video_window_moved(GtkWidget *widget, GdkEvent *event, gpointer
return FALSE;
}
static gint do_gtk_widget_destroy(GtkWidget *w){
gtk_widget_destroy(w);
return FALSE;
}
static void schedule_video_controls_disapearance(GtkWidget *w){
gint timeout=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"timeout"));
if (timeout != 0) g_source_remove(timeout);
timeout=g_timeout_add(3000,(GSourceFunc)do_gtk_widget_destroy,w);
g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(timeout));
}
static GtkWidget *show_video_controls(GtkWidget *video_window){
GtkWidget *w;
w=(GtkWidget*)g_object_get_data(G_OBJECT(video_window),"controls");
......@@ -240,7 +252,6 @@ static GtkWidget *show_video_controls(GtkWidget *video_window){
const char *stock_button=isfullscreen ? GTK_STOCK_LEAVE_FULLSCREEN : GTK_STOCK_FULLSCREEN;
gint response_id=isfullscreen ? GTK_RESPONSE_NO : GTK_RESPONSE_YES ;
GtkWidget *image = gtk_image_new_from_icon_name(linphone_gtk_get_ui_config("stop_call_icon_name","linphone-stop-call"), GTK_ICON_SIZE_BUTTON);
gint timeout;
GtkWidget *button;
w=gtk_dialog_new_with_buttons("",GTK_WINDOW(video_window),GTK_DIALOG_DESTROY_WITH_PARENT,stock_button,response_id,NULL);
gtk_window_set_opacity(GTK_WINDOW(w),0.5);
......@@ -255,18 +266,14 @@ static GtkWidget *show_video_controls(GtkWidget *video_window){
gtk_widget_show(button);
gtk_dialog_add_action_widget(GTK_DIALOG(w),button,GTK_RESPONSE_APPLY);
g_signal_connect(w,"response",(GCallback)on_controls_response,video_window);
timeout=g_timeout_add(3000,(GSourceFunc)gtk_widget_destroy,w);
g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(timeout));
schedule_video_controls_disapearance(w);
g_signal_connect(w,"destroy",(GCallback)on_controls_destroy,NULL);
g_object_set_data(G_OBJECT(w),"video_window",video_window);
g_object_set_data(G_OBJECT(video_window),"controls",w);
set_video_controls_position(video_window);
gtk_widget_show(w);
}else{
gint timeout=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(w),"timeout"));
g_source_remove(timeout);
timeout=g_timeout_add(3000,(GSourceFunc)gtk_widget_destroy,w);
g_object_set_data(G_OBJECT(w),"timeout",GINT_TO_POINTER(timeout));
schedule_video_controls_disapearance(w);
}
return w;
}
......
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