Assertion triggered when opening a new file and "Load UI" is disabled in settings #109422

Closed
opened 2023-06-27 22:44:04 +02:00 by Eyad Ahmed · 15 comments
Contributor

System Information
Operating system: Linux-6.3.8-200.fc38.x86_64-x86_64-with-glibc2.37 64 Bits, WAYLAND UI
Graphics card: AMD Radeon Graphics (renoir, LLVM 16.0.5, DRM 3.52, 6.3.8-200.fc38.x86_64) AMD 4.6 (Core Profile) Mesa 23.1.2

Blender Version
Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-06-26 04:05, hash: 4a80d0b6d59a
Worked: (newest version of Blender that worked as expected)

Short description of error
Opening a new file triggers an assertion and crashes when "Load UI" is disabled

Exact steps for others to reproduce the error

  1. Disable "Load UI" by going to Edit -> Preferences -> Save & Load, uncheck "Load UI"
  2. Try File -> New -> General, crash ^^

image

**System Information** Operating system: Linux-6.3.8-200.fc38.x86_64-x86_64-with-glibc2.37 64 Bits, WAYLAND UI Graphics card: AMD Radeon Graphics (renoir, LLVM 16.0.5, DRM 3.52, 6.3.8-200.fc38.x86_64) AMD 4.6 (Core Profile) Mesa 23.1.2 **Blender Version** Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-06-26 04:05, hash: `4a80d0b6d59a` Worked: (newest version of Blender that worked as expected) **Short description of error** Opening a new file triggers an assertion and crashes when "Load UI" is disabled **Exact steps for others to reproduce the error** 1. Disable "Load UI" by going to Edit -> Preferences -> Save & Load, uncheck "Load UI" 2. Try File -> New -> General, crash ^^ ![image](/attachments/ef7e2b48-15ae-4134-957a-b0882286ebae)
Eyad Ahmed added the
Status
Needs Triage
Type
Report
Priority
Normal
labels 2023-06-27 22:44:04 +02:00
Iliya Katushenock added the
Interest
User Interface
label 2023-06-27 22:49:51 +02:00
Member

Not able to reproduce on Windows.

Not able to reproduce on _Windows_.
Member

Can reproduce on linux (XOrg).

Here it just hangs (I'm RelWithDebInfo so it probably went past the assertion and caused something else to break downstream).

Can reproduce on linux (XOrg). Here it just hangs (I'm `RelWithDebInfo` so it probably went past the assertion and caused something else to break downstream).
YimingWu added
Module
Core
Status
Confirmed
Platform
Linux
and removed
Status
Needs Triage
labels 2023-06-28 04:52:40 +02:00

Seems to happen on Windows too.

BLI_assert failed: C:\Users\jesse\source\blender-git\blender\source\blender\windowmanager\intern\wm_window.c:2406, WM_window_screen_rect_calc(), at 'BLI_rcti_is_valid(&screen_rect)'

_BLI_assert_abort C:\Users\jesse\source\blender-git\blender\source\blender\blenlib\intern\BLI_assert.c:49
WM_window_screen_rect_calc C:\Users\jesse\source\blender-git\blender\source\blender\windowmanager\intern\wm_window.c:2406
screen_geom_vertices_scale C:\Users\jesse\source\blender-git\blender\source\blender\editors\screen\screen_geometry.c:243
ED_screen_refresh C:\Users\jesse\source\blender-git\blender\source\blender\editors\screen\screen_edit.c:677
ED_screens_init C:\Users\jesse\source\blender-git\blender\source\blender\editors\screen\screen_edit.c:707
WM_check C:\Users\jesse\source\blender-git\blender\source\blender\windowmanager\intern\wm.c:516
Seems to happen on Windows too. ``` BLI_assert failed: C:\Users\jesse\source\blender-git\blender\source\blender\windowmanager\intern\wm_window.c:2406, WM_window_screen_rect_calc(), at 'BLI_rcti_is_valid(&screen_rect)' _BLI_assert_abort C:\Users\jesse\source\blender-git\blender\source\blender\blenlib\intern\BLI_assert.c:49 WM_window_screen_rect_calc C:\Users\jesse\source\blender-git\blender\source\blender\windowmanager\intern\wm_window.c:2406 screen_geom_vertices_scale C:\Users\jesse\source\blender-git\blender\source\blender\editors\screen\screen_geometry.c:243 ED_screen_refresh C:\Users\jesse\source\blender-git\blender\source\blender\editors\screen\screen_edit.c:677 ED_screens_init C:\Users\jesse\source\blender-git\blender\source\blender\editors\screen\screen_edit.c:707 WM_check C:\Users\jesse\source\blender-git\blender\source\blender\windowmanager\intern\wm.c:516 ```
YimingWu removed the
Platform
Linux
label 2023-06-28 05:02:44 +02:00
Member

@deadpin - Seems to happen on Windows too.

Did it require anything extra or different from the instructions above?

> @deadpin - Seems to happen on Windows too. Did it require anything extra or different from the instructions above?

No, nothing extra. Once you flip the User Preference and save, triggering is just a matter of File->New. The rect in question has dimensions 0,0,19,-25 and the assert fails because 19 (ymin) is > -25 (ymax)

No, nothing extra. Once you flip the User Preference and save, triggering is just a matter of File->New. The rect in question has dimensions `0,0,19,-25` and the assert fails because 19 (ymin) is > -25 (ymax)
Iliya Katushenock added
Module
User Interface
and removed
Module
Core
Interest
User Interface
labels 2023-06-28 10:41:49 +02:00
Member

I see it! I had to delete my AppData config files though. Then on the next launch I asked it to create a New config (not migrated from 3.6). Then turned off "Load UI", File / New / General and I see the same error.

Edit: It is just the existence of a "startup.blend" that hid the error from me.

Haven't looked too deeply yet, but WM_check is checking to make sure everything is okay, ED_screen_refresh calls screen_geom_vertices_scale but the win has posx, posy, sizex, & sizey all zeros. That calls WM_window_screen_rect_calc which adjusts the screen for global areas and you get that negative ymax (probably because the Status Bar is shown) which causes the assert.

I see it! I had to delete my AppData config files though. Then on the next launch I asked it to create a New config (not migrated from 3.6). Then turned off "Load UI", File / New / General and I see the same error. Edit: It is just the existence of a "startup.blend" that hid the error from me. Haven't looked too deeply yet, but WM_check is checking to make sure everything is okay, ED_screen_refresh calls screen_geom_vertices_scale but the win has posx, posy, sizex, & sizey all zeros. That calls WM_window_screen_rect_calc which adjusts the screen for global areas and you get that negative ymax (probably because the Status Bar is shown) which causes the assert.
Member

Oh, just to clarify, this issue is ONLY when selecting File / New. Opening existing files work fine.

Frankly I'm not sure of expected behavior in this case. Just because you have "Load UI" off do you really not want any window/editor changes if you select File / New / VFX? I would assume that "Load UI" is meant to apply to files you open not those that are newly created.

But this is is caused by:

If there is no "startup.blend" and "Load UI" is turned off. When loading a new file wm_file_read_setup_wm_finalize calls wm_clear_default_size which clears the positions and sizes of the existing windows. But assuming that because "Load UI" is off we don't then load this data from the opened file, and then later WM_window_screen_rect_calc adjusts the zero-sized window to allow for the Statusbar and we assert on the negative vertical size.

@mont29

Oh, just to clarify, this issue is ONLY when selecting File / New. Opening existing files work fine. Frankly I'm not sure of expected behavior in this case. Just because you have "Load UI" off do you really not want any window/editor changes if you select File / New / VFX? I would assume that "Load UI" is meant to apply to files you open not those that are newly created. But this is is caused by: - https://projects.blender.org/blender/blender/commit/32bbfbb06ed331f021b89401f12adecf13d9eaa0 - https://projects.blender.org/blender/blender/commit/7ef8389dad6b65264a5aee7de6a579256d0a01e2 If there is no "startup.blend" and "Load UI" is turned off. When loading a new file `wm_file_read_setup_wm_finalize` calls `wm_clear_default_size` which clears the positions and sizes of the existing windows. But assuming that because "Load UI" is off we don't then load this data from the opened file, and then later WM_window_screen_rect_calc adjusts the zero-sized window to allow for the Statusbar and we assert on the negative vertical size. @mont29
Author
Contributor

Oh, just to clarify, this issue is ONLY when selecting File / New. Opening existing files work fine.

Frankly I'm not sure of expected behavior in this case. Just because you have "Load UI" off do you really not want any window/editor changes if you select File / New / VFX? I would assume that "Load UI" is meant to apply to files you open not those that are newly created.

But this is is caused by:

If there is no "startup.blend" and "Load UI" is turned off. When loading a new file wm_file_read_setup_wm_finalize calls wm_clear_default_size which clears the positions and sizes of the existing windows. But assuming that because "Load UI" is off we don't then load this data from the opened file, and then later WM_window_screen_rect_calc adjusts the zero-sized window to allow for the Statusbar and we assert on the negative vertical size.

@mont29

File new is technically opening the startup.blend file, i guess screen rect calc should be skipped too when load ui is off ^^ the only problem is what happens when blender is just starting up hmm, because that also goes through similar code path

> Oh, just to clarify, this issue is ONLY when selecting File / New. Opening existing files work fine. > > Frankly I'm not sure of expected behavior in this case. Just because you have "Load UI" off do you really not want any window/editor changes if you select File / New / VFX? I would assume that "Load UI" is meant to apply to files you open not those that are newly created. > > But this is is caused by: > - https://projects.blender.org/blender/blender/commit/32bbfbb06ed331f021b89401f12adecf13d9eaa0 > - https://projects.blender.org/blender/blender/commit/7ef8389dad6b65264a5aee7de6a579256d0a01e2 > > If there is no "startup.blend" and "Load UI" is turned off. When loading a new file `wm_file_read_setup_wm_finalize` calls `wm_clear_default_size` which clears the positions and sizes of the existing windows. But assuming that because "Load UI" is off we don't then load this data from the opened file, and then later WM_window_screen_rect_calc adjusts the zero-sized window to allow for the Statusbar and we assert on the negative vertical size. > > @mont29 > > File new is technically opening the startup.blend file, i guess screen rect calc should be skipped too when load ui is off ^^ the only problem is what happens when blender is just starting up hmm, because that also goes through similar code path

I cannot reproduce with current main... Tried fully renaming my .config/blender folder, set again the userpref, still no issue doing any File -> New operation, no assert, no crash.

Think this needs more specific repro steps?

I cannot reproduce with current main... Tried fully renaming my `.config/blender` folder, set again the userpref, still no issue doing any `File -> New` operation, no assert, no crash. Think this needs more specific repro steps?
Member

If there is no "startup.blend" and "Load UI" is turned off. When loading a new file wm_file_read_setup_wm_finalize calls wm_clear_default_size which clears the positions and sizes of the existing windows. But assuming that because "Load UI" is off we don't then load this data from the opened file, and then later WM_window_screen_rect_calc adjusts the zero-sized window to allow for the Statusbar and we assert on the negative vertical size.

@Harley From what I can find out with debugger stepping, this is the closest explanation. (I could be misinterpreting tho)

@mont29 I can still reproduce with the same step in the description and blender stops refreshing with 0% cpu, then if I drag the window to resize, the "Layout" layout becomes something like this (and I'm still able to interact with stuff that's displayed correctly)

图片

> If there is no "startup.blend" and "Load UI" is turned off. When loading a new file wm_file_read_setup_wm_finalize calls wm_clear_default_size which clears the positions and sizes of the existing windows. But assuming that because "Load UI" is off we don't then load this data from the opened file, and then later WM_window_screen_rect_calc adjusts the zero-sized window to allow for the Statusbar and we assert on the negative vertical size. @Harley From what I can find out with debugger stepping, this is the closest explanation. (I could be misinterpreting tho) @mont29 I can still reproduce with the same step in the description and blender stops refreshing with 0% cpu, then if I drag the window to resize, the "Layout" layout becomes something like this (and I'm still able to interact with stuff that's displayed correctly) ![图片](/attachments/86943ea2-37ca-4f69-bc1e-64f8f8f1be11)
257 KiB
Member

@mont29 - I cannot reproduce with current main...

Yes, it is quite specific.

This problem does not occur if you have a custom startup, so confirm that you don't have a "startup.blend" in C:\Users(username)\AppData\Roaming\Blender Foundation\Blender\4.0\config\

Launch Blender, ensure that "Load UI" is unchecked in Preferences and ensure that preferences are saved.

File / New / General. And you should get an assert if debugging.

In wm_file_read_setup_wm_finalize both is_read_homefile and is_factory_startup are true so wm_clear_default_size is called which sets the position and sizes of the current window to zero. Normally this is okay because it would be fixed from the values in the newly-loaded file. But here with "Load UI" off this stays at zeros. WM_check, ED_screens_init, ED_screen_refresh. Then screen_geom_vertices_scale subtracts the height of the status bar from the rect, which gives it negative size in WM_window_screen_rect_calc at BLI_rcti_is_valid.

It isn't as easy as changing wm_file_read_setup_wm_finalize so that it does not clear the window if not load UI. This would mean it also would not be called at the initial launch of blender if load UI is off. It wasn't immediately clear to me how to differentiate between the initial load of blender and later loading.

> @mont29 - I cannot reproduce with current main... Yes, it is quite specific. This problem does not occur if you have a custom startup, so confirm that you don't have a "startup.blend" in C:\Users\(username)\AppData\Roaming\Blender Foundation\Blender\4.0\config\ Launch Blender, ensure that "Load UI" is unchecked in Preferences and ensure that preferences are saved. File / New / General. And you should get an assert if debugging. In `wm_file_read_setup_wm_finalize` both `is_read_homefile` and `is_factory_startup` are true so `wm_clear_default_size` is called which sets the position and sizes of the current window to zero. Normally this is okay because it would be fixed from the values in the newly-loaded file. But here with "Load UI" off this stays at zeros. WM_check, ED_screens_init, ED_screen_refresh. Then screen_geom_vertices_scale subtracts the height of the status bar from the rect, which gives it negative size in WM_window_screen_rect_calc at BLI_rcti_is_valid. It isn't as easy as changing `wm_file_read_setup_wm_finalize` so that it does not clear the window if not load UI. This would mean it also would not be called at the initial launch of blender if load UI is off. It wasn't immediately clear to me how to differentiate between the initial load of blender and later loading.

Am on linux, so config path for Blender here is ~/.config/blender/4.0/config. but yes, renamed this, got first start popup on starting Blender, updated and saved userprefs, do File -> New, and get absolutely no crash or assert...

Could be a difference in GHOST implementations (windows and linux Wayland crashing, but Linux X11 being fine ?).

Anyway, can someone try this one-liner and report whether it fixes the issue or not? thanks!

diff --git a/source/blender/blenkernel/intern/blendfile.cc b/source/blender/blenkernel/intern/blendfile.cc
index d1145ebe7dc..ca6fe4643fa 100644
--- a/source/blender/blenkernel/intern/blendfile.cc
+++ b/source/blender/blenkernel/intern/blendfile.cc
@@ -447,6 +447,7 @@ static void swap_wm_data_for_blendfile(ReuseOldBMainData *reuse_data, const bool
   else {
     swap_old_bmain_data_for_blendfile(reuse_data, ID_WM);
     old_wm->init_flag &= ~WM_INIT_FLAG_WINDOW;
+    reuse_data->wm_setup_data->old_wm = old_wm;
   }
 }
 
Am on linux, so config path for Blender here is `~/.config/blender/4.0/config`. but yes, renamed this, got first start popup on starting Blender, updated and saved userprefs, do `File -> New`, and get absolutely no crash or assert... Could be a difference in GHOST implementations (windows and linux Wayland crashing, but Linux X11 being fine ?). Anyway, can someone try this one-liner and report whether it fixes the issue or not? thanks! ```Diff diff --git a/source/blender/blenkernel/intern/blendfile.cc b/source/blender/blenkernel/intern/blendfile.cc index d1145ebe7dc..ca6fe4643fa 100644 --- a/source/blender/blenkernel/intern/blendfile.cc +++ b/source/blender/blenkernel/intern/blendfile.cc @@ -447,6 +447,7 @@ static void swap_wm_data_for_blendfile(ReuseOldBMainData *reuse_data, const bool else { swap_old_bmain_data_for_blendfile(reuse_data, ID_WM); old_wm->init_flag &= ~WM_INIT_FLAG_WINDOW; + reuse_data->wm_setup_data->old_wm = old_wm; } } ```
Member

@mont29 - Anyway, can someone try this one-liner and report whether it fixes the issue or not? thanks!

That fixes it perfectly! Although that also requires removing an assert that would be hit when doing File / New /

diff --git a/source/blender/blenkernel/intern/blendfile.cc b/source/blender/blenkernel/intern/blendfile.cc
index d1145ebe7dc..ca6fe4643fa 100644
--- a/source/blender/blenkernel/intern/blendfile.cc
+++ b/source/blender/blenkernel/intern/blendfile.cc
@@ -447,6 +447,7 @@ static void swap_wm_data_for_blendfile(ReuseOldBMainData *reuse_data, const bool
   else {
     swap_old_bmain_data_for_blendfile(reuse_data, ID_WM);
     old_wm->init_flag &= ~WM_INIT_FLAG_WINDOW;
+    reuse_data->wm_setup_data->old_wm = old_wm;
   }
 }
 
diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc
index 74c02bb740e..8e3ccf1e03f 100644
--- a/source/blender/windowmanager/intern/wm_files.cc
+++ b/source/blender/windowmanager/intern/wm_files.cc
@@ -440,7 +440,6 @@ static void wm_file_read_setup_wm_finalize(bContext *C,
     }
   }
   /* Else just using the new WM read from file, nothing to do. */
-  BLI_assert(wm_setup_data->old_wm == nullptr);
   MEM_delete(wm_setup_data);
 }

> @mont29 - Anyway, can someone try this one-liner and report whether it fixes the issue or not? thanks! That fixes it perfectly! Although that also requires removing an assert that would be hit when doing File / New / ```Diff diff --git a/source/blender/blenkernel/intern/blendfile.cc b/source/blender/blenkernel/intern/blendfile.cc index d1145ebe7dc..ca6fe4643fa 100644 --- a/source/blender/blenkernel/intern/blendfile.cc +++ b/source/blender/blenkernel/intern/blendfile.cc @@ -447,6 +447,7 @@ static void swap_wm_data_for_blendfile(ReuseOldBMainData *reuse_data, const bool else { swap_old_bmain_data_for_blendfile(reuse_data, ID_WM); old_wm->init_flag &= ~WM_INIT_FLAG_WINDOW; + reuse_data->wm_setup_data->old_wm = old_wm; } } diff --git a/source/blender/windowmanager/intern/wm_files.cc b/source/blender/windowmanager/intern/wm_files.cc index 74c02bb740e..8e3ccf1e03f 100644 --- a/source/blender/windowmanager/intern/wm_files.cc +++ b/source/blender/windowmanager/intern/wm_files.cc @@ -440,7 +440,6 @@ static void wm_file_read_setup_wm_finalize(bContext *C, } } /* Else just using the new WM read from file, nothing to do. */ - BLI_assert(wm_setup_data->old_wm == nullptr); MEM_delete(wm_setup_data); } ```
Contributor

What are the chances of getting this commit to master soon?

What are the chances of getting this commit to master soon?
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-06-30 10:29:36 +02:00
Contributor

Thank you.

Thank you.
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#109422
No description provided.