Commit 16b19f7b authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

graph_draw(): Fix segfault

parent fc8ac1da
Pipeline #231 failed with stage
in 49 minutes and 36 seconds
......@@ -1829,7 +1829,7 @@ boost::python::object cairo_draw(GraphInterface& gi,
Cairo::Context cr(PycairoContext_GET(ocr.ptr()));
if (nodesfirst)
run_action<graph_tool::detail::always_directed>()
run_action<>()
(gi, std::bind(do_cairo_draw_vertices(), std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3,
std::ref(vattrs), std::ref(eattrs), std::ref(vdefaults),
......@@ -1838,7 +1838,7 @@ boost::python::object cairo_draw(GraphInterface& gi,
vertex_scalar_vector_properties(),
vorder_t())(pos, vorder);
run_action<graph_tool::detail::always_directed>()
run_action<>()
(gi, std::bind(do_cairo_draw_edges(), std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3,
std::ref(vattrs), std::ref(eattrs),
......@@ -1849,7 +1849,7 @@ boost::python::object cairo_draw(GraphInterface& gi,
if (!nodesfirst)
{
run_action<graph_tool::detail::always_directed>()
run_action<>()
(gi, std::bind(do_cairo_draw_vertices(), std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3,
std::ref(vattrs), std::ref(eattrs), std::ref(vdefaults),
......@@ -1858,7 +1858,6 @@ boost::python::object cairo_draw(GraphInterface& gi,
vertex_scalar_vector_properties(),
vorder_t())(pos, vorder);
}
yield(boost::python::object(count));
};
return boost::python::object(CoroGenerator(dispatch));
}
......
......@@ -682,17 +682,20 @@ def cairo_draw(g, pos, cr, vprops=None, eprops=None, vorder=None, eorder=None,
parallel_distance = _defaults
eprops["control_points"] = position_parallel_edges(g, pos, loop_angle,
parallel_distance)
g = GraphView(g, directed=True)
generator = libgraph_tool_draw.cairo_draw(g._Graph__graph, _prop("v", g, pos),
_prop("v", g, vorder), _prop("e", g, eorder),
nodesfirst, vattrs, eattrs, vdefs, edefs, res,
max_render_time, cr)
if max_render_time >= 0:
return generator
def gen():
for count in generator:
yield count
cr.restore()
return gen()
else:
for count in generator:
pass
cr.restore()
cr.restore()
def color_contrast(color):
c = np.asarray(color)
......
......@@ -465,10 +465,13 @@ class GraphWidget(Gtk.DrawingArea):
w = self.get_window()
if w is None:
return False
self.regenerate_generator = None
self.regen_context = None
self.base = w.create_similar_surface(cairo.CONTENT_COLOR_ALPHA,
*geometry)
self.base_geometry = geometry
self.regenerate_generator = None
m = cairo.Matrix()
m.translate(self.get_allocated_width(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment