From 972045d8f80f0a03fcd4ff6d445c089c07e06b7e Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 24 Dec 2015 22:43:41 +0100 Subject: [PATCH] fix a segfault caused by re-entrance at the point when we're connecting a new node to the UI-Bus, the new node's BusTerm is not yet initialised, since we need the uplink connection we're about to create for setting up this BusTerm. Consequently, the new nodes's ID is not yet initialised, so we need to pass this endpoint-ID explicitly to the registration function. --- src/gui/ctrl/bus-controller.cpp | 6 +++--- src/gui/ctrl/bus-term.hpp | 2 +- src/gui/ctrl/nexus.hpp | 6 ++++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gui/ctrl/bus-controller.cpp b/src/gui/ctrl/bus-controller.cpp index 7860d0da1..f4b5c2f17 100644 --- a/src/gui/ctrl/bus-controller.cpp +++ b/src/gui/ctrl/bus-controller.cpp @@ -87,7 +87,7 @@ namespace ctrl { BusTerm BusTerm::attach (ID identity, Tangible& newNode) { - return BusTerm(identity, theBus_.routeAdd(newNode)); + return BusTerm(identity, theBus_.routeAdd (identity,newNode)); } @@ -161,9 +161,9 @@ namespace ctrl { * @return corresponding up-link for the initiating node to use */ BusTerm& - BusTerm::routeAdd (Tangible& node) + BusTerm::routeAdd (ID identity, Tangible& node) { - return theBus_.routeAdd(node); + return theBus_.routeAdd (identity, node); } diff --git a/src/gui/ctrl/bus-term.hpp b/src/gui/ctrl/bus-term.hpp index fc2216a6d..e3847ff80 100644 --- a/src/gui/ctrl/bus-term.hpp +++ b/src/gui/ctrl/bus-term.hpp @@ -127,7 +127,7 @@ namespace ctrl{ , theBus_(attached_to) { } - virtual BusTerm& routeAdd(Tangible&); + virtual BusTerm& routeAdd(ID,Tangible&); virtual void routeDetach(ID) noexcept; }; diff --git a/src/gui/ctrl/nexus.hpp b/src/gui/ctrl/nexus.hpp index a61231805..0129e3d62 100644 --- a/src/gui/ctrl/nexus.hpp +++ b/src/gui/ctrl/nexus.hpp @@ -99,13 +99,15 @@ namespace ctrl{ } /** add a new down-link connection to the routing table + * @param identity the [endpoint-ID][BusTerm::endpointID_] used + * to address the new element to be connected to the bus. * @return backlink for the new Tangible's BusTerm to * attach itself to the Nexus. */ virtual BusTerm& - routeAdd (Tangible& newNode) override + routeAdd (ID identity, Tangible& newNode) override { - routingTable_[newNode] = &newNode; + routingTable_[identity] = &newNode; return *this; }