Fix COMMIT::Stage assertion when CHT_DONE set on CHT_MODIFY
When undoLevelItem() remaps a child item to its parent, the change type is forced to CHT_MODIFY but the CHT_DONE flag from the original CHT_ADD/CHT_REMOVE was left intact. CHT_DONE means the original add/remove was already applied to the child, but that semantic doesn't carry over when we remap to a modify of the parent. Strip CHT_DONE at the remapping site instead of as a general catch-all. Keep the assertion as defense-in-depth for any future code path that might combine CHT_MODIFY with CHT_DONE directly. Fixes KICAD-102A
This commit is contained in:
+7
-3
@@ -50,11 +50,15 @@ COMMIT& COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType, BASE_SCREEN* aS
|
||||
EDA_ITEM* undoItem = undoLevelItem( aItem );
|
||||
|
||||
if( undoItem != aItem )
|
||||
{
|
||||
changeType = CHT_MODIFY;
|
||||
|
||||
// CHT_MODIFY and CHT_DONE are not compatible
|
||||
if( changeType == CHT_MODIFY )
|
||||
wxASSERT( ( flags & CHT_DONE ) == 0 );
|
||||
// CHT_DONE means the original add/remove was already applied to the child, but that
|
||||
// semantic doesn't carry over when we remap to a modify of the parent
|
||||
flags &= ~CHT_DONE;
|
||||
}
|
||||
|
||||
wxASSERT( changeType != CHT_MODIFY || ( flags & CHT_DONE ) == 0 );
|
||||
|
||||
switch( changeType )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user