Crash in nvoglv64.dll entering edit mode on curve #94454

Closed
opened 2021-12-29 01:51:31 +01:00 by eldee smith · 16 comments

System Information
Operating system: Windows-10-10.0.19043-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 3080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 472.39

Blender Version
Broken: version: 3.1.0 Alpha, branch: master, commit date: 2021-12-26 20:08, hash: 20b438d523
Worked: 2.93 LTS

Caused by eb0eb54d96

Blender crashes with an access violation in nvoglv64.dll when entering edit mode on a curve with the following script running. This worked fine in Blender 2.93 et al, so something has changed with object.to_mesh() that nvoglv64.dll does not like.
See the attached blend file, and run the embedded minimum repro crash_script text file- which is a simple GL handler that should use blf to display the number of mesh polygons in a curve.

# Blender 3.1.0, Commit date: 2021-12-26 20:08, Hash 20b438d523c9
bpy.ops.object.editmode_toggle()  # Operator

# backtrace
Exception Record:

ExceptionCode         : EXCEPTION_ACCESS_VIOLATION
Exception Address     : 0x00007FF9798BBDD0
Exception Module      : nvoglv64.dll
Exception Flags       : 0x00000000
Exception Parameters  : 0x2
	Parameters[0] : 0x0000000000000000
	Parameters[1] : 0x0000000000000000


Stack trace:
nvoglv64.dll        :0x00007FF9798BBDD0  Symbols not available

# Python backtrace

the repro script, for posterity:

import bpy, blf

def draw_test():
    ui_scale = bpy.context.preferences.system.ui_scale
    blf.color(0, 1,1,0,1)
    blf.size(0, int(12 * ui_scale), 72)

    blf.position(0, int(20 * ui_scale), int(bpy.context.region.height) - int(200 * ui_scale), 0)
    blf.draw(0, f"With the curve selected, enter edit mode.")

    blf.position(0, int(20 * ui_scale), int(bpy.context.region.height) - int(220 * ui_scale), 0)
    blf.draw(0, f"If it doesn't crash immediately, try selecting a few points.")

    if bpy.context.mode != 'EDIT_CURVE':
        return

    obj = bpy.context.active_object
    value = 0
    if obj is not None and obj.type == 'CURVE':
        # NOTE: crash is caused by this:
        me = obj.to_mesh()
        value = len(me.polygons)
        obj.to_mesh_clear()
    
    blf.position(0, int(20 * ui_scale), int(bpy.context.region.height) - int(240 * ui_scale), 0)
    blf.draw(0, f"We'll never get to this point, but the curve has {value} polygons.")

handler = None
def register():
    global handler
    handler = bpy.types.SpaceView3D.draw_handler_add(draw_test, (), 'WINDOW', 'POST_PIXEL')
    
def unregister():
    global handler
    if handler is not None:
        bpy.types.SpaceView3D.draw_handler_remove(handler, 'WINDOW')
        handler = None
    
if __name__ == "__main__":
    register()

edit: apparently the blend file did not attach, here it is again
crash.blend

You can get around it passing the evaluated object to to_mesh, see:
crash_corrected.blend

**System Information** Operating system: Windows-10-10.0.19043-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 3080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 472.39 **Blender Version** Broken: version: 3.1.0 Alpha, branch: master, commit date: 2021-12-26 20:08, hash: `20b438d523` Worked: 2.93 LTS Caused by eb0eb54d96 Blender crashes with an access violation in nvoglv64.dll when entering edit mode on a curve with the following script running. This worked fine in Blender 2.93 et al, so something has changed with object.to_mesh() that nvoglv64.dll does not like. See the attached blend file, and run the embedded minimum repro `crash_script` text file- which is a simple GL handler that should use blf to display the number of mesh polygons in a curve. ``` # Blender 3.1.0, Commit date: 2021-12-26 20:08, Hash 20b438d523c9 bpy.ops.object.editmode_toggle() # Operator # backtrace Exception Record: ExceptionCode : EXCEPTION_ACCESS_VIOLATION Exception Address : 0x00007FF9798BBDD0 Exception Module : nvoglv64.dll Exception Flags : 0x00000000 Exception Parameters : 0x2 Parameters[0] : 0x0000000000000000 Parameters[1] : 0x0000000000000000 Stack trace: nvoglv64.dll :0x00007FF9798BBDD0 Symbols not available # Python backtrace ``` the repro script, for posterity: ``` import bpy, blf def draw_test(): ui_scale = bpy.context.preferences.system.ui_scale blf.color(0, 1,1,0,1) blf.size(0, int(12 * ui_scale), 72) blf.position(0, int(20 * ui_scale), int(bpy.context.region.height) - int(200 * ui_scale), 0) blf.draw(0, f"With the curve selected, enter edit mode.") blf.position(0, int(20 * ui_scale), int(bpy.context.region.height) - int(220 * ui_scale), 0) blf.draw(0, f"If it doesn't crash immediately, try selecting a few points.") if bpy.context.mode != 'EDIT_CURVE': return obj = bpy.context.active_object value = 0 if obj is not None and obj.type == 'CURVE': # NOTE: crash is caused by this: me = obj.to_mesh() value = len(me.polygons) obj.to_mesh_clear() blf.position(0, int(20 * ui_scale), int(bpy.context.region.height) - int(240 * ui_scale), 0) blf.draw(0, f"We'll never get to this point, but the curve has {value} polygons.") handler = None def register(): global handler handler = bpy.types.SpaceView3D.draw_handler_add(draw_test, (), 'WINDOW', 'POST_PIXEL') def unregister(): global handler if handler is not None: bpy.types.SpaceView3D.draw_handler_remove(handler, 'WINDOW') handler = None if __name__ == "__main__": register() ``` edit: apparently the blend file did not attach, here it is again [crash.blend](https://archive.blender.org/developer/F12780026/crash.blend) You can get around it passing the evaluated object to `to_mesh`, see: [crash_corrected.blend](https://archive.blender.org/developer/F12780484/crash_corrected.blend)
Author

Added subscriber: @testure

Added subscriber: @testure

Added subscriber: @schampions

Added subscriber: @schampions

This comment was removed by @schampions

*This comment was removed by @schampions*

Added subscriber: @ThomasDinges

Added subscriber: @ThomasDinges
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: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

Caused by eb0eb54d96

You can get around it passing the evaluated object to to_mesh, see:
crash_corrected.blend

It is not totally obvious for me why this crashes (passing the non-evaluated curve) and the commit message would imply this is not generally a problem:

If the object isn't evaluated, it uses a temporary copy of the object
with modifiers removed to create the mesh in the same way.

So, I would still like @HooglyBoogly to take a look (it is just not nice to have working [in 2.93] scripts resulting in a crash all of a sudden without explanation somewhere -- even if 3.0 is a compatibility breaking release)
It is also not mentioned in [if it would be an expected breaking change] https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Python_API

Caused by eb0eb54d96 You can get around it passing the evaluated object to `to_mesh`, see: [crash_corrected.blend](https://archive.blender.org/developer/F12780484/crash_corrected.blend) It is not totally obvious for me why this crashes (passing the non-evaluated curve) and the commit message would imply this is not generally a problem: > If the object isn't evaluated, it uses a temporary copy of the object > with modifiers removed to create the mesh in the same way. So, I would still like @HooglyBoogly to take a look (it is just not nice to have working [in 2.93] scripts resulting in a crash all of a sudden without explanation somewhere -- even if 3.0 is a compatibility breaking release) It is also not mentioned in [if it would be an expected breaking change] https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Python_API
Member

Unfortunately I can't reproduce this at the moment:
{F12780516 size=full}
Maybe I'm missing something?

Unfortunately I can't reproduce this at the moment: {[F12780516](https://archive.blender.org/developer/F12780516/image.png) size=full} Maybe I'm missing something?
Member

In #94454#1279834, @HooglyBoogly wrote:
Unfortunately I can't reproduce this at the moment:
Maybe I'm missing something?

Is this crash.blend? or crash_corrected.blend?
Are you mouse-selecting points in editmode?
Have you done extrusion prior?

> In #94454#1279834, @HooglyBoogly wrote: > Unfortunately I can't reproduce this at the moment: > Maybe I'm missing something? Is this `crash.blend`? or `crash_corrected.blend`? Are you mouse-selecting points in editmode? Have you done extrusion prior?
Member

Oops! Apparently I was using crash_corrected.blend. I can reproduce it now. I'll look into this.

Oops! Apparently I was using `crash_corrected.blend`. I can reproduce it now. I'll look into this.
Hans Goudey self-assigned this 2021-12-29 23:44:46 +01:00
Member

I've found the fix, it was a relatively simple mistake in eb0eb54d96. However, based on the code there I would strongly recommend you use @lichtwerk's corrected version that uses a depsgraph to get the actual evaluated mesh (or a copy of it anyway).

I've found the fix, it was a relatively simple mistake in eb0eb54d96. However, based on the code there I would strongly recommend you use @lichtwerk's corrected version that uses a depsgraph to get the actual evaluated mesh (or a copy of it anyway).

This issue was referenced by 50c39ff8fe

This issue was referenced by 50c39ff8fe041153bda41657a694e0b154b8cd65

This issue was referenced by c0fdf16561

This issue was referenced by c0fdf16561034f85aadae8a513db16144609b821
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
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#94454
No description provided.