dunnart
dunnart copied to clipboard
dunnartcanvaslib Connector::disconnect_from does not handle dangling connections
here is my proposed modification, but I am not sure if it breaks things around:
void Connector::disconnect_from(ShapeObj *shape, uint pinClassID) { int type; // ADD THIS LINE if ((m_src_pt.shape == shape) && ((pinClassID == 0) || (m_src_pt.pinClassID == pinClassID))) { m_src_pt.shape = NULL; m_src_pt.pinClassID = 0; type = VertID::src; // ADD THIS LINE }
if ((m_dst_pt.shape == shape) &&
((pinClassID == 0) || (m_dst_pt.pinClassID == pinClassID)))
{
m_dst_pt.shape = NULL;
m_dst_pt.pinClassID = 0;
type = VertID::tar; // ADD THIS LINE
}
setNewLibavoidEndpoint(type); // ADD THIS LINE
}
this sometimes causes ConnRef::common_updateEndPoint to crash. So I modified the beginning, replacing the assert with the following: void ConnRef::common_updateEndPoint(const unsigned int type, ConnEnd connEnd) { const Point& point = connEnd.position();
// COLA_ASSERT((type == (unsigned int) VertID::src) || // (type == (unsigned int) VertID::tar)); if (!((type == (unsigned int) VertID::src) || // ADD THIS LINE (type == (unsigned int) VertID::tar))) // ADD THIS LINE return; // ADD THIS LINE