[gnumeric] Graph: fix critical.



commit 0c42feddd7e6534d85d23a79d1058d459a182489
Author: Morten Welinder <terra gnome org>
Date:   Mon Mar 30 11:33:35 2015 -0400

    Graph: fix critical.
    
    This fixes a critical that affects lots of tests.

 ChangeLog                |    7 ++++++-
 src/sheet-object-graph.c |    8 +++++---
 2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 232941d..00634e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-30  Morten Welinder  <terra gnome org>
+
+       * src/sheet-object-graph.c (sheet_object_graph_new): Allow NULL
+       graph here.
+
 2015-03-30  Jean Brefort  <jean brefort normalesup org>
 
        * src/graph.h: add support for absolute anchoring of sheet objects.
@@ -7,7 +12,7 @@
        * src/sheet-object-cell-comment.c: ditto.
        * src/sheet-object-component.c: ditto.
        * src/sheet-object-graph.c: ditto and make graphs not anymore resize with
-       cells by default. [#684450] 
+       cells by default. [#684450]
        * src/sheet-object-image.c: make images don't resize with cells by default.
        * src/sheet-object.c : add support for absolute anchoring of sheet objects.
        * src/sheet-object.h: ditto.
diff --git a/src/sheet-object-graph.c b/src/sheet-object-graph.c
index 7436808..bd37883 100644
--- a/src/sheet-object-graph.c
+++ b/src/sheet-object-graph.c
@@ -614,7 +614,7 @@ GSF_CLASS_FULL (SheetObjectGraph, sheet_object_graph,
 
 /**
  * sheet_object_graph_new:
- * @graph: #GogGraph
+ * @graph: (allow-none): #GogGraph
  *
  * Adds a reference to @graph and creates a gnumeric sheet object wrapper
  * Returns: (transfer full): the newly allocated #SheetObject.
@@ -623,7 +623,9 @@ SheetObject *
 sheet_object_graph_new (GogGraph *graph)
 {
        SheetObject *sog = g_object_new (GNM_SO_GRAPH_TYPE, NULL);
-       GnmGraphDataClosure *data = (GnmGraphDataClosure *) g_object_get_data (G_OBJECT (graph), 
"data-closure");
+       GnmGraphDataClosure *data = graph
+               ? (GnmGraphDataClosure *) g_object_get_data (G_OBJECT (graph), "data-closure")
+               : NULL;
        sheet_object_graph_set_gog (sog, graph);
        if (data != NULL)
                sog->anchor.mode = data->anchor_mode;
@@ -649,7 +651,7 @@ sheet_object_graph_get_gog (SheetObject *sog)
 /**
  * sheet_object_graph_set_gog:
  * @sog: #SheetObjectGraph
- * @graph: #GogGraph
+ * @graph: (allow-none): #GogGraph
  *
  * If @graph is non NULL add a reference to it, otherwise create a new graph.
  * Assign the graph to its SheetObjectGraph wrapper and initialize the


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