[gtk+] Robustness fixes for drag cancel animation
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Robustness fixes for drag cancel animation
- Date: Fri, 30 Jan 2015 15:14:44 +0000 (UTC)
commit 4f1780c7828737266b7aa1ae8372b7f1c7711b69
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Jan 30 06:07:34 2015 -0500
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.
gtk/gtkdnd.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c
index 6e829d1..733af5e 100644
--- a/gtk/gtkdnd.c
+++ b/gtk/gtkdnd.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]