File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -4266,6 +4266,19 @@ class Activity {
42664266 const blk = this . blocks . dragGroup [ b ] ;
42674267 this . blocks . blockList [ blk ] . trash = false ;
42684268 this . blocks . moveBlockRelative ( blk , dx , dy ) ;
4269+
4270+ // Re-cache the container if it was uncached to save
4271+ // memory in sendStackToTrash().
4272+ const block = this . blocks . blockList [ blk ] ;
4273+ if ( block . container && ! block . container . bitmapCache ) {
4274+ block . container . cache (
4275+ 0 ,
4276+ 0 ,
4277+ Math . max ( block . width , 1 ) ,
4278+ Math . max ( block . height , 1 )
4279+ ) ;
4280+ }
4281+
42694282 this . blocks . blockList [ blk ] . show ( ) ;
42704283 }
42714284
Original file line number Diff line number Diff line change @@ -399,6 +399,13 @@ class Block {
399399 updateCache ( ) {
400400 const that = this ;
401401 return new Promise ( ( resolve , reject ) => {
402+ // If the container has no active bitmap cache (e.g., trashed
403+ // blocks whose cache was freed), skip the update silently.
404+ if ( that . container && ! that . container . bitmapCache ) {
405+ resolve ( ) ;
406+ return ;
407+ }
408+
402409 let loopCount = 0 ;
403410 const MAX_RETRIES = 15 ;
404411 const INITIAL_DELAY = 100 ;
You can’t perform that action at this time.
0 commit comments