[graph-gtk] Fixed segfaulting



commit 219d2869173761969a94b578475d3d080dec53b4
Author: Isaac Wagner <isaacbw src gnome org>
Date:   Wed Aug 8 22:33:39 2012 -0400

    Fixed segfaulting

 graph-gtk/graph-gtk-node.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/graph-gtk/graph-gtk-node.c b/graph-gtk/graph-gtk-node.c
index 7984c46..200f48b 100644
--- a/graph-gtk/graph-gtk-node.c
+++ b/graph-gtk/graph-gtk-node.c
@@ -86,6 +86,18 @@ graph_gtk_node_class_init (GraphGtkNodeClass *klass)
 
   klass->render_node = graph_gtk_node_render_default;
   klass->recalculate_size = graph_gtk_node_recalculate_size_default;
+
+  //Let applications connect to this signal to add to the rendering process without having to subclass GraphGtkNode
+  g_signal_new("post-render",
+	       GRAPH_TYPE_GTK_NODE,
+	       G_SIGNAL_RUN_FIRST,
+	       0, //no class method
+	       NULL, //no accumulator,
+	       NULL,
+	       NULL,
+	       G_TYPE_NONE,
+	       1,
+	       G_TYPE_POINTER /*cairo_t*/);
 }
 
 static void
@@ -315,6 +327,8 @@ graph_gtk_node_render(GraphGtkNode* self, cairo_t* cairo)
     self->failed_size_calculation = !graph_gtk_node_recalculate_size(self);
 
   GRAPH_GTK_NODE_GET_CLASS(self)->render_node(self, cairo);
+
+  g_signal_emit_by_name(self, "post-render", cairo);
 }
 
 GList*
@@ -579,8 +593,12 @@ graph_gtk_node_show_image(GraphGtkNode* self, gboolean show_image)
 void
 graph_gtk_node_remove_pads(GraphGtkNode *self)
 {
+  //memory leak
+
+  /*
   g_list_free_full(self->output_pads, g_free);
   g_list_free_full(self->input_pads, g_free);
+  */
 
   self->output_pads = NULL;
   self->input_pads = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]