Skip to content

Commit

Permalink
Fixes #2276: Apply tracker changes in the correct order.
Browse files Browse the repository at this point in the history
  • Loading branch information
yueh committed Nov 25, 2016
1 parent b0ef489 commit eb8320a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/main/java/appeng/me/cache/GridStorageCache.java
Expand Up @@ -87,15 +87,18 @@ public void removeNode( final IGridNode node, final IGridHost machine )
if( machine instanceof ICellContainer )
{
final ICellContainer cc = (ICellContainer) machine;
final CellChangeTracker tracker = new CellChangeTracker();

this.inactiveCellProviders.remove( cc );
this.removeCellProvider( cc, tracker );
this.getGrid().postEvent( new MENetworkCellArrayUpdate() );
this.removeCellProvider( cc, new CellChangeTracker() ).applyChanges();

tracker.applyChanges();
}

if( machine instanceof IStackWatcherHost )
{
final IStackWatcher myWatcher = this.watchers.get( machine );

if( myWatcher != null )
{
myWatcher.clear();
Expand All @@ -112,11 +115,16 @@ public void addNode( final IGridNode node, final IGridHost machine )
final ICellContainer cc = (ICellContainer) machine;
this.inactiveCellProviders.add( cc );

this.getGrid().postEvent( new MENetworkCellArrayUpdate() );
final CellChangeTracker tracker = new CellChangeTracker();

if( node.isActive() )
{
this.addCellProvider( cc, new CellChangeTracker() ).applyChanges();
this.addCellProvider( cc, tracker );
}

this.getGrid().postEvent( new MENetworkCellArrayUpdate() );

tracker.applyChanges();
}

if( machine instanceof IStackWatcherHost )
Expand Down Expand Up @@ -177,10 +185,10 @@ private CellChangeTracker removeCellProvider( final ICellProvider cc, final Cell
{
if( this.activeCellProviders.contains( cc ) )
{
this.inactiveCellProviders.add( cc );
this.activeCellProviders.remove( cc );

BaseActionSource actionSrc = new BaseActionSource();

if( cc instanceof IActionHost )
{
actionSrc = new MachineSource( (IActionHost) cc );
Expand Down

0 comments on commit eb8320a

Please sign in to comment.