[Lemon-user] Issue with ListDigraph::NodeMaps

Péter Kovács kpeter at inf.elte.hu
Wed Jun 14 08:37:00 CEST 2017


Dear Marco,

Could you send a self-contained code example for reproducing the issue? 
I miss e.g. the implementation of the constructor of Query2D (where 
constructors of the node maps should be called).

Regards,
Péter



> Dear Lemon-Team,
>
> I've run across a problem with your ListDigraph::NodeMapswhich I can't
> solve on my own.
>
> Unfortunately, as the code is rather intricate, I find myself unable to
> provide a minimal example, but the simplified structure is as follows:
> The function testcreates a Graph2Dwith an underlying
> lemon::ListDigraphobject and calls a shortestPathwrapper. This
> shortestPathfunction creates a Query2Dobject, which knows the underlying
> ListDigraph, and keeps a few NodeMaps(see below). The first three
> NodeMapsnever caused an issue, but when I implemented the fourth one
> called _potential, the destructor of Graph2Dthrows a segfault. Note that
> none of the destructors are implemented by me, I use the standard
> implicit destructors.
>
> In the attached valgrind output, I could trace the segfault down to the
> clear()function in alteration_notifier.h -- yet, as three
> NodeMapsalready exist and seemingly work fine, I'm at a loss as to why
> this segfault occurs. I'm grateful for any support you can provide!
>
> Regards,
> Marco
>
>
> void test(const Problem& problem)
> {
>     Graph2D g2D(problem);
>     g2D.shortestPath("from","to");
> }
>
> class Graph2D
> {
> public:
>     Graph2D(const Problem& problem);
>     lemon::ListDigraph G;
>
>     void shortestPath(const std::string& from, const std::string& to)
>     lemon::ListDigraph::Node getNode(const std::string& name);
> }
>
> void Graph2D::shortestPath(const std::string& from, const std::string& to)
> {
>     Query2D query(*this);
>
>     lemon::ListDigraph::Node s = getNode(from);
>     lemon::ListDigraph::Node t = getNode(to);
>
>     query.run(s,t);
> }
>
>
> class Query2D
> {
> public:
>     Query2D(const Graph2D& g2D);
>
>     const Graph2D* const _bg;
>     const lemon::ListDigraph& G;
>
>     void run(lemon::ListDigraph::Node s, lemon::ListDigraph::Node t);
>
>     /** The following three NodeMaps have been here for a long time and
> never caused any issues */
>     lemon::ListDigraph::NodeMap<short> _settled;
>     lemon::ListDigraph::NodeMap<size_t> _id;
>     lemon::ListDigraph::NodeMap<short> _nodeType;
>
>     /** This map causes trouble. If left in, it causes the attached
> SIGSEGV (even though it is never used after initialisation!), if
> commented out, everything works nice and smooth */
>     lemon::ListDigraph::NodeMap<double> _potential;
> }
>
>
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user
>



More information about the Lemon-user mailing list