Robustness fixes for drag cancel animation

gtk_widget_get_frame_clock() can return NULL. Deal with that
by silently stopping the drag cancel animation in this case.
This commit is contained in:
Matthias Clasen 2015-01-30 06:07:34 -05:00
parent 34c29d8d3c
commit 4f1780c782

View File

@ -3942,16 +3942,24 @@ gtk_drag_anim_destroy (GtkDragAnim *anim)
static gboolean
gtk_drag_anim_timeout (gpointer data)
{
GtkWidget *icon_window;
GtkDragAnim *anim = data;
GtkDragSourceInfo *info = anim->info;
GtkWidget *widget = info->widget;
GdkFrameClock *frame_clock = gtk_widget_get_frame_clock (widget);
gint64 current_time = gdk_frame_clock_get_frame_time (frame_clock);
GtkWidget *icon_window;
GdkFrameClock *frame_clock;
gint64 current_time;
int hot_x, hot_y;
double f = (current_time - anim->start_time) / (double) ANIM_TIME;
double f;
double t;
frame_clock = gtk_widget_get_frame_clock (info->widget);
if (!frame_clock)
return G_SOURCE_REMOVE;
current_time = gdk_frame_clock_get_frame_time (frame_clock);
f = (current_time - anim->start_time) / (double) ANIM_TIME;
if (f >= 1.0)
return G_SOURCE_REMOVE;