Skip to content

Commit

Permalink
+ fix order of removed objects in transaction list
Browse files Browse the repository at this point in the history
+ add assert to check for obvious error
+ removed unneeded method
  • Loading branch information
wwmayer committed Jul 23, 2016
1 parent 0f2db90 commit f2bad45
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/App/Transactions.cpp
Expand Up @@ -150,6 +150,8 @@ void Transaction::addObjectNew(TransactionalObject *Obj)
else {
pos->second->status = TransactionObject::New;
pos->second->_NameInDocument = Obj->detachFromDocument();
// move item at the end to make sure the order of removal is kept
_Objects.splice(_Objects.end(), _Objects, pos);
}
}
else {
Expand Down
12 changes: 6 additions & 6 deletions src/Gui/Document.cpp
Expand Up @@ -575,16 +575,16 @@ void Document::slotRedoDocument(const App::Document& doc)

void Document::addViewProvider(Gui::ViewProviderDocumentObject* vp)
{
// Hint: The undo/redo first adds the view provider to the Gui
// document before adding the objects to the App document.

// the view provider is added by TransactionViewProvider and an
// object can be there only once
assert(d->_ViewProviderMap.find(vp->getObject()) == d->_ViewProviderMap.end());
vp->setStatus(Detach, false);
d->_ViewProviderMap[vp->getObject()] = vp;
}

void Document::removeViewProvider(Gui::ViewProviderDocumentObject* vp)
{
vp->setStatus(Detach, true);
d->_ViewProviderMap.erase(vp->getObject());
}

void Document::setModified(bool b)
{
d->_isModified = b;
Expand Down
1 change: 0 additions & 1 deletion src/Gui/Document.h
Expand Up @@ -86,7 +86,6 @@ class GuiExport Document : public Base::Persistence
//@}

void addViewProvider(Gui::ViewProviderDocumentObject*);
void removeViewProvider(Gui::ViewProviderDocumentObject*);

public:
/** @name Signals of the document */
Expand Down

0 comments on commit f2bad45

Please sign in to comment.