fritzing / fritzing-app

Fritzing desktop application
http://fritzing.org
Other
4.02k stars 830 forks source link

undo not working properly sometimes #1462

Closed davidperrenoud closed 2 years ago

davidperrenoud commented 10 years ago

From irasc...@gmail.com on May 27, 2011 00:31:41

Delete and undo-delete the orange wire connecting the piezo in bb view. The piezo is no longer connected in schematic view.

What we know about this file is that there was a whole set of deletions, followed by a bunch of undos. The earlier version of the file (uploaded in issue #1460 ) doesn't have this problem

Attachment: CosmicRayGun (2).fz

Original issue: http://code.google.com/p/fritzing/issues/detail?id=1462

failiz commented 4 years ago

I could not replicate this in 0.9.4 and the file is not available.

KjellMorgenstern commented 4 years ago

I recently stumbled upon some QUndoCommands that looked broken:

// /src/autoroute/autorouter.cpp:268
void Autorouter::addUndoConnection(bool connect, ConnectorItem * connectorItem, BaseCommand::CrossViewType crossView, QUndoCommand * parentCommand)
{
    foreach (ConnectorItem * toConnectorItem, connectorItem->connectedToItems()) {
        auto vw = qobject_cast<VirtualWire *>(toConnectorItem->attachedTo());
        if (vw) continue;

        auto ccc = new ChangeConnectionCommand(m_sketchWidget, crossView,
                toConnectorItem->attachedToID(), toConnectorItem->connectorSharedID(),
                connectorItem->attachedToID(), connectorItem->connectorSharedID(),
                ViewLayer::specFromID(toConnectorItem->attachedToViewLayerID()),
                connect, parentCommand);
        ccc->setUpdateConnections(false);
    }
}

Undo commands are created, more precise, subcomands. But I could not yet find where those commands are put into the m_commands list. It looks like ccc is just leaked. However, I can't say I fully understood this code yet, maybe it is not even called.

failiz commented 3 years ago

I found weird behaviours while doing undos, but never found a way to replicate them.

failiz commented 3 years ago

Remove imported label

KjellMorgenstern commented 2 years ago

The original issue described can not be reproduced. Other issues seem to unspecific. We have solved some issues about undo, for example #3603 and #3720