- // Task which will be unblocked only after the copy has
- // occurred (this will only be created if the draw task
- // was postponed)
- if (srcReady != null) srcLock = srcLayer.sync(null, true);
+ // Block source layer until draw completes
+ // Note that the draw MAY have already been performed at this point,
+ // in which case creating a lock on the source layer will lead to
+ // deadlock (the draw task has already run and will thus never
+ // clear the lock)
+ if (!drawComplete)
+ srcLock = srcLayer.sync(null, true);