Regression: Repeating resizing image and undoing causes view in image editor strange state, and editing it causes crash. #99356

Open
opened 2022-07-03 12:39:26 +02:00 by takaaki takeda · 17 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: GeForce GTX 970/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.86

Blender Version
Broken: version: 3.3.0 Alpha, branch: master, commit date: 2022-07-01 14:46, hash: d0e3388848
Broken: 3.2
Worked: 3.1

Caused/exposed by e06399c223

Short description of error
If resizeing image and undoing is repeated, view in image editor becomes strange state.
(It looks like that the image size is incorrect state).
If the image is editted in this state, the blender would crash.

Crash_ResizeUndo_2.gif

At the first undoing, it looks O.K.
But if I repeat resizing and undoing one more time, the image becomes strange.

Exact steps for others to reproduce the error

Followings are what I did in the video above.

  1. Open image editor and make a new image. (1024x1024)
  2. Resize the image to 256x256 from menu.
  3. Undo it.
  4. Then, Resize the image to 256x256 one more time.
  5. Undo it.
  6. The image size in the editor becomes strange.
  7. If I edit the image, blender crashes.

I tried above process in several conditions.
I found that
A. this does not happens in 3.1. It happens after 3.2
B. If I checked Undo Legacy option, this does not happen. It happens in standard undo mode.

**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: GeForce GTX 970/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 430.86 **Blender Version** Broken: version: 3.3.0 Alpha, branch: master, commit date: 2022-07-01 14:46, hash: `d0e3388848` Broken: 3.2 Worked: 3.1 Caused/exposed by e06399c223 **Short description of error** If resizeing image and undoing is repeated, view in image editor becomes strange state. (It looks like that the image size is incorrect state). If the image is editted in this state, the blender would crash. ![Crash_ResizeUndo_2.gif](https://archive.blender.org/developer/F13253632/Crash_ResizeUndo_2.gif) At the first undoing, it looks O.K. But if I repeat resizing and undoing one more time, the image becomes strange. **Exact steps for others to reproduce the error** Followings are what I did in the video above. 1. Open image editor and make a new image. (1024x1024) 2. Resize the image to 256x256 from menu. 3. Undo it. 4. Then, Resize the image to 256x256 one more time. 5. Undo it. 6. The image size in the editor becomes strange. 7. If I edit the image, blender crashes. I tried above process in several conditions. I found that A. this does not happens in 3.1. It happens after 3.2 B. If I checked Undo Legacy option, this does not happen. It happens in standard undo mode.
Author

Added subscriber: @popqjp

Added subscriber: @popqjp
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Can confirm, will check

Can confirm, will check
Member

Added subscriber: @mont29

Added subscriber: @mont29
Member

Caused/exposed by e06399c223

CC @mont29

Caused/exposed by e06399c223 CC @mont29
Philipp Oeser changed title from Repeating resizing image and undoing causes view in image editor strange state, and editing it causes crash. to Regression: Repeating resizing image and undoing causes view in image editor strange state, and editing it causes crash. 2022-07-03 15:06:37 +02:00

Added subscriber: @Jeroen-Bakker

Added subscriber: @Jeroen-Bakker

This commit just fixes the fact that caches were systematically trashed on undo/redo, so think it indeed only reveals the problem.

Note that this also happens with regular image files (loaded from disk), not only generated ones.

Would love to have first someone knowing the image code have a look at this one, @Jeroen-Bakker maybe? Suspect the cache is not properly cleared/re-created when size changes, or marked as dirty... But not really my area of expertise.

This commit just fixes the fact that caches were systematically trashed on undo/redo, so think it indeed only reveals the problem. Note that this also happens with regular image files (loaded from disk), not only generated ones. Would love to have first someone knowing the image code have a look at this one, @Jeroen-Bakker maybe? Suspect the cache is not properly cleared/re-created when size changes, or marked as dirty... But not really my area of expertise.
Jeroen Bakker self-assigned this 2022-07-06 08:22:05 +02:00
Member

Seems like a faulty state in the image engine.

Seems like a faulty state in the image engine.
Member

I am not able to reproduce it on

Operating system: Linux-5.17.5-76051705-generic-x86_64-with-glibc2.34 64 Bits
Graphics card: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 515.48.07

Will check on other platforms as well. Bastien confirmed he could reproduce it.

I am not able to reproduce it on ``` Operating system: Linux-5.17.5-76051705-generic-x86_64-with-glibc2.34 64 Bits Graphics card: NVIDIA GeForce GTX 1080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 515.48.07 ``` Will check on other platforms as well. Bastien confirmed he could reproduce it.

Added subscriber: @sycszero

Added subscriber: @sycszero
Member

Added subscriber: @pragma37

Added subscriber: @pragma37
Member

I took a look at this.

I'm able to reproduce it, except when the Image Editor is on Paint Mode.
I wasn't able to reproduce the issue when the image is in float mode, either.

I noticed that image_undosys_poll, the poll function used by BKE_UNDOSYS_TYPE_IMAGE only returns true when the SpaceImage mode is set to SI_MODE_PAINT, or when the object mode is set OB_MODE_TEXTURE_PAINT.

Updating it to return true regardless of the SpaceImage mode seems to fix the issue.

I have not submitted a patch because I don't have the full picture of the undo system, so I'm not sure if this is a true fix or just a "happy" side effect.
Why the current image undo would work at all outside of Paint Mode if the poll function discards those cases?

image_undosys_poll.diff

I took a look at this. I'm able to reproduce it, except when the Image Editor is on Paint Mode. I wasn't able to reproduce the issue when the image is in float mode, either. I noticed that `image_undosys_poll`, the poll function used by `BKE_UNDOSYS_TYPE_IMAGE` only returns `true` when the `SpaceImage` mode is set to `SI_MODE_PAINT`, or when the object mode is set `OB_MODE_TEXTURE_PAINT`. Updating it to return `true` regardless of the `SpaceImage` mode seems to fix the issue. I have not submitted a patch because I don't have the full picture of the undo system, so I'm not sure if this is a true fix or just a "happy" side effect. Why the current image undo would work at all outside of Paint Mode if the poll function discards those cases? [image_undosys_poll.diff](https://archive.blender.org/developer/F13602255/image_undosys_poll.diff)
Member

@pragma37 your solution makes sense. especially as resizing can happen in any mode. @mont29 do you see any issue with that?

@pragma37 your solution makes sense. especially as resizing can happen in any mode. @mont29 do you see any issue with that?

Added subscriber: @ideasman42

Added subscriber: @ideasman42

I would be surprised if that was really a good solution, to me it sounds more like by-passing the problem existing in regular 'memfile' undo, by forcing image-editing dedicated undo system all the time?

But think @ideasman42 would be more able to answer to this question?

I would be surprised if that was really a good solution, to me it sounds more like by-passing the problem existing in regular 'memfile' undo, by forcing image-editing dedicated undo system all the time? But think @ideasman42 would be more able to answer to this question?
Member

I tried to reproduce it many times on my systems with different configuration and steps. I was able to reproduce it once, so it is still a thing. Not sure I am able to reproduce it reliable enough to find make a fix for it.

I tried to reproduce it many times on my systems with different configuration and steps. I was able to reproduce it once, so it is still a thing. Not sure I am able to reproduce it reliable enough to find make a fix for it.
Jeroen Bakker removed their assignment 2022-11-15 16:30:47 +01:00
Philipp Oeser removed the
Interest
EEVEE & Viewport
label 2023-02-09 15:12:31 +01:00
Bastien Montagne added this to the Core project 2023-02-09 15:43:54 +01:00
Bastien Montagne removed this from the Core project 2023-02-09 18:20:30 +01:00
Philipp Oeser added the
Interest
Core
label 2023-02-10 11:09:23 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#99356
No description provided.