Segfault on unregistering operator/menu with open props dialog. #89123

Open
opened 2021-06-13 23:01:09 +02:00 by Will · 9 comments

System Information
Operating system: Linux
Graphics card: Intel

Blender Version
Broken: 2.92, 2.93

Short description of error

When an operator currently has a wm.props_dialog_(self) open, unregistering it will cause a segfault.

This only seems to happen reliably when the module it's from has at least one bpy.types.Menu subclass that's also been registered.

The displayed values of property fields in the dialog will sometimes flicker and switch values with each other for a split second before the segfault.

Exact steps for others to reproduce the error

InvokeSegfault.blend

  1. Open the attached file.

  2. Invoke the operator from the 3DView toolbar.

  3. Use a system hotkey (E.G. ALT+TAB) to switch to the window with the text editor space while leaving the props dialog open.

  4. Run the script again from the text editor window.

**System Information** Operating system: Linux Graphics card: Intel **Blender Version** Broken: 2.92, 2.93 **Short description of error** When an operator currently has a `wm.props_dialog_(self)` open, unregistering it will cause a segfault. This only seems to happen reliably when the module it's from has at least one `bpy.types.Menu` subclass that's also been registered. The displayed values of property fields in the dialog will sometimes flicker and switch values with each other for a split second before the segfault. **Exact steps for others to reproduce the error** [InvokeSegfault.blend](https://archive.blender.org/developer/F10169997/InvokeSegfault.blend) 1. Open the attached file. 2. Invoke the operator from the 3DView toolbar. 3. Use a system hotkey (E.G. `ALT`+`TAB`) to switch to the window with the text editor space while leaving the props dialog open. 4. Run the script again from the text editor window.
Author

Added subscriber: @WCN

Added subscriber: @WCN
Author

Here's a somewhat shorter reproducer that triggers invokes the operator and triggers the crash automatically:

InvokeSegfaultB.blend

As with before, I could only get it to happen reliably when there's also a menu class that gets (un) regsitered.

"""Press the Run Script button for a segfault."""

import bpy


class InvokeOperator(bpy.types.Operator):
	"""Tooltip"""
	bl_idname = "object.invoke_segfault"
	bl_label = "Invoke"
	bl_options = {'REGISTER', 'UNDO'}

	prop: bpy.props.EnumProperty(name="prop", items=[(c,)*3 for c in "ABC"], default="A")
	prop2: bpy.props.StringProperty(name="prop2", default="value")
	
	def invoke(self, context, event):
		context.window_manager.invoke_props_dialog(self)
		return {'RUNNING_MODAL'}

	def execute(self, context):
		return {'FINISHED'}


class SomeMenu(bpy.types.Menu):
	bl_idname = "TEST_MT_menu"
	bl_label = "InvokeMenu"

	def draw(self, context):
		pass


def register():
	bpy.utils.register_class(InvokeOperator)
	bpy.utils.register_class(SomeMenu)

def unregister():
	bpy.utils.unregister_class(InvokeOperator)
	bpy.utils.unregister_class(SomeMenu)


if __name__ == "__main__":
	register()
	bpy.ops.object.invoke_segfault('INVOKE_DEFAULT')
	unregister()
Here's a somewhat shorter reproducer that triggers invokes the operator and triggers the crash automatically: [InvokeSegfaultB.blend](https://archive.blender.org/developer/F10170017/InvokeSegfaultB.blend) As with before, I could only get it to happen reliably when there's also a menu class that gets (un) regsitered. ``` """Press the Run Script button for a segfault.""" import bpy class InvokeOperator(bpy.types.Operator): """Tooltip""" bl_idname = "object.invoke_segfault" bl_label = "Invoke" bl_options = {'REGISTER', 'UNDO'} prop: bpy.props.EnumProperty(name="prop", items=[(c,)*3 for c in "ABC"], default="A") prop2: bpy.props.StringProperty(name="prop2", default="value") def invoke(self, context, event): context.window_manager.invoke_props_dialog(self) return {'RUNNING_MODAL'} def execute(self, context): return {'FINISHED'} class SomeMenu(bpy.types.Menu): bl_idname = "TEST_MT_menu" bl_label = "InvokeMenu" def draw(self, context): pass def register(): bpy.utils.register_class(InvokeOperator) bpy.utils.register_class(SomeMenu) def unregister(): bpy.utils.unregister_class(InvokeOperator) bpy.utils.unregister_class(SomeMenu) if __name__ == "__main__": register() bpy.ops.object.invoke_segfault('INVOKE_DEFAULT') unregister() ```
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Can recreate the crash with version 3.0.0 (7af40ccf5f)

 	blender.exe!ui_but_text_password_hide(unsigned char * password_str, uiBut * but, const bool restore) Line 2830
 	blender.exe!widget_draw_text_icon(const uiFontStyle * fstyle, const uiWidgetColors * wcol, uiBut * but, rcti * rect) Line 2360
 	blender.exe!ui_draw_but(const bContext * C, ARegion * region, uiStyle * style, uiBut * but, rcti * rect) Line 4944
 	blender.exe!UI_block_draw(const bContext * C, uiBlock * block) Line 2054
 	blender.exe!ui_block_region_draw(const bContext * C, ARegion * region) Line 410
 	blender.exe!ED_region_do_draw(bContext * C, ARegion * region) Line 563
 	blender.exe!wm_draw_window_offscreen(bContext * C, wmWindow * win, bool stereo) Line 758
 	blender.exe!wm_draw_window(bContext * C, wmWindow * win) Line 867
 	blender.exe!wm_draw_update(bContext * C) Line 1066
 	blender.exe!WM_main(bContext * C) Line 654
 	blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 562
Can recreate the crash with version 3.0.0 (`7af40ccf5f`) ``` blender.exe!RNA_property_subtype(PropertyRNA * prop) Line 1184 blender.exe!ui_but_text_password_hide(unsigned char * password_str, uiBut * but, const bool restore) Line 2830 blender.exe!widget_draw_text_icon(const uiFontStyle * fstyle, const uiWidgetColors * wcol, uiBut * but, rcti * rect) Line 2360 blender.exe!ui_draw_but(const bContext * C, ARegion * region, uiStyle * style, uiBut * but, rcti * rect) Line 4944 blender.exe!UI_block_draw(const bContext * C, uiBlock * block) Line 2054 blender.exe!ui_block_region_draw(const bContext * C, ARegion * region) Line 410 blender.exe!ED_region_do_draw(bContext * C, ARegion * region) Line 563 blender.exe!wm_draw_window_offscreen(bContext * C, wmWindow * win, bool stereo) Line 758 blender.exe!wm_draw_window(bContext * C, wmWindow * win) Line 867 blender.exe!wm_draw_update(bContext * C) Line 1066 blender.exe!WM_main(bContext * C) Line 654 blender.exe!main(int argc, const unsigned char * * UNUSED_argv_c) Line 562 ```
Member

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

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

Changed status from 'Confirmed' to: 'Needs User Info'

Changed status from 'Confirmed' to: 'Needs User Info'
Member

@WCN hi, I'm not able to repro the crash anymore. Could you check again in 2.93.11 or any succeeding version?: https://builder.blender.org/download/daily/

@WCN hi, I'm not able to repro the crash anymore. Could you check again in 2.93.11 or any succeeding version?: https://builder.blender.org/download/daily/
Member

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'
Member

Sorry, can still confirm the crash

Sorry, can still confirm the crash
Philipp Oeser removed the
Interest
User Interface
label 2023-02-10 09:23:24 +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
2 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#89123
No description provided.