Merge pull request #4909 from QualiaRain/fix/xyz-grid-state-fixes

Fix XYZ grid state leaks and sub-grid gallery leak
This commit is contained in:
Vladimir Mandic
2026-06-12 10:35:59 +02:00
committed by GitHub
2 changed files with 5 additions and 2 deletions
+2 -1
View File
@@ -251,6 +251,7 @@ class XYZGridScript(scripts_manager.Script):
except Exception as e:
log.error(f"XYZ grid: invalid axis values {e}")
errors.display(e, 'xyz')
shared.state.end(jobid)
return None
Image.MAX_IMAGE_PIXELS = None # disable check in Pillow and rely on check below to allow large custom image sizes
@@ -392,7 +393,7 @@ class XYZGridScript(scripts_manager.Script):
return processed # something broke, no further handling needed.
have_grid = 1 if include_grid else 0
have_subgrids = len(zs) if len(zs) > 1 and include_subgrids else 0
have_subgrids = len(zs) if len(zs) > 1 and (include_grid or include_subgrids) else 0 # sub-grids are created whenever the main grid is, see draw_xyz_grid
have_images = processed.images[have_grid+have_subgrids:]
processed.infotexts[:have_grid+have_subgrids] = grid_infotext[:have_grid+have_subgrids] # update infotexts with grid and subgrid info
log.debug(f'XYZ grid: grid={have_grid} subgrids={have_subgrids} images={len(have_images)} total={len(processed.images)}')
+3 -1
View File
@@ -267,6 +267,8 @@ class XYZGridScript(scripts_manager.Script):
except Exception as e:
log.error(f"XYZ grid: invalid axis values {e}")
errors.display(e, 'xyz')
active = False
shared.state.end(jobid)
return None
Image.MAX_IMAGE_PIXELS = None # disable check in Pillow and rely on check below to allow large custom image sizes
@@ -421,7 +423,7 @@ class XYZGridScript(scripts_manager.Script):
return processed # something broke, no further handling needed.
have_grid = 1 if include_grid else 0
have_subgrids = len(zs) if len(zs) > 1 and include_subgrids else 0
have_subgrids = len(zs) if len(zs) > 1 and (include_grid or include_subgrids) else 0 # sub-grids are created whenever the main grid is, see draw_xyz_grid
have_images = processed.images[have_grid+have_subgrids:]
processed.infotexts[:have_grid+have_subgrids] = grid_infotext[:have_grid+have_subgrids] # update infotexts with grid and subgrid info
log.debug(f'XYZ grid: grid={have_grid} subgrids={have_subgrids} images={len(have_images)} total={len(processed.images)}')