Skip to content

Commit

Permalink
Try to fix Ubi, per previous API changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
linas committed Oct 4, 2013
1 parent e5ab895 commit 72b649f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions opencog/visualization/ubigraph/Ubigrapher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void Ubigrapher::watchSignals()
c_add = space.atomSpaceAsync->addAtomSignal(
boost::bind(&Ubigrapher::handleAddSignal, this, _1, _2));
c_remove = space.atomSpaceAsync->removeAtomSignal(
boost::bind(&Ubigrapher::handleRemoveSignal, this, _1, _2));
boost::bind(&Ubigrapher::atomRemoveSignal, this, _1, _2));
assert(c_add.connected() && c_remove.connected());
listening = true;
} else {
Expand Down Expand Up @@ -171,12 +171,11 @@ bool Ubigrapher::handleAddSignal(AtomSpaceImpl* as, Handle h)
}
}

bool Ubigrapher::handleRemoveSignal(AtomSpaceImpl* as, Handle h)
bool Ubigrapher::handleRemoveSignal(AtomSpaceImpl* as, AtomPtr a)
{
// XXX This is an error waiting to happen. Signals handling adds must be
// thread safe as they are called from the AtomSpace event loop
if (!isConnected()) return false;
AtomPtr a = as->cloneAtom(h);
usleep(pushDelay);
if (classserver().isA(a->getType(),NODE))
return removeVertex(h);
Expand All @@ -186,11 +185,10 @@ bool Ubigrapher::handleRemoveSignal(AtomSpaceImpl* as, Handle h)
LinkPtr l(LinkCast(a));
if (l && l->getOutgoingSet().size() == 2 &&
as->getIncoming(h).size() == 0)
return removeEdges(h);
return removeEdges(a->getHandle());
}
return removeVertex(h);
return removeVertex(a->getHandle());
}

}

void Ubigrapher::updateSizeOfHandle(Handle h, property_t p, float multiplier, float baseline)
Expand Down
4 changes: 2 additions & 2 deletions opencog/visualization/ubigraph/Ubigrapher.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class Ubigrapher
*/
bool removeEdges(Handle h);

bool handleAddSignal(AtomSpaceImpl* as, Handle h); //! Signal handler for atom adds.
bool handleRemoveSignal(AtomSpaceImpl* as, Handle h); //! Signal handler for atom removals.
bool handleAddSignal(AtomSpaceImpl*, Handle); //! Signal handler for atom adds.
bool atomRemoveSignal(AtomSpaceImpl*, AtomPtr); //! Signal handler for atom removals.

bool listening; //! Whether the Ubigrapher is listening for AtomSpace signals.
boost::signals::connection c_add; //! Connection to add atom signals
Expand Down

0 comments on commit 72b649f

Please sign in to comment.