[gnome-builder] rg: check that our timespan is non-zero
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] rg: check that our timespan is non-zero
- Date: Sat, 3 Oct 2015 23:31:41 +0000 (UTC)
commit d39f631049b9edb583abd3a8ca3f05e101dfcd40
Author: Christian Hergert <christian hergert me>
Date: Sat Oct 3 16:29:40 2015 -0700
rg: check that our timespan is non-zero
contrib/rg/rg-graph.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/contrib/rg/rg-graph.c b/contrib/rg/rg-graph.c
index 3b4eb0b..b230351 100644
--- a/contrib/rg/rg-graph.c
+++ b/contrib/rg/rg-graph.c
@@ -122,21 +122,16 @@ rg_graph_tick_cb (GtkWidget *widget,
g_assert (RG_IS_GRAPH (self));
if ((priv->surface == NULL) || (priv->table == NULL) || !gtk_widget_get_visible (widget))
- {
- if (priv->tick_handler != 0)
- {
- gtk_widget_remove_tick_callback (widget, priv->tick_handler);
- priv->tick_handler = 0;
- }
+ goto remove_handler;
- return G_SOURCE_REMOVE;
- }
+ timespan = rg_table_get_timespan (priv->table);
+ if (timespan == 0)
+ goto remove_handler;
gtk_widget_get_allocation (widget, &alloc);
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
end_time = rg_table_get_end_time (priv->table);
- timespan = rg_table_get_timespan (priv->table);
x_offset = -((frame_time - end_time) / (gdouble)timespan * alloc.width);
@@ -147,6 +142,15 @@ rg_graph_tick_cb (GtkWidget *widget,
}
return G_SOURCE_CONTINUE;
+
+remove_handler:
+ if (priv->tick_handler != 0)
+ {
+ gtk_widget_remove_tick_callback (widget, priv->tick_handler);
+ priv->tick_handler = 0;
+ }
+
+ return G_SOURCE_REMOVE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]