Crash changing Brush size in Grease Pencil #79107

Closed
opened 2020-07-20 10:38:14 +02:00 by Antonio Vazquez · 8 comments

Last source coded compiled at 20/07/2020 10:35

To reproduce:

  1. Open 2D Template.
  2. Draw a line.
  3. Enter in Sculpt mode.
  4. Press F and change radius.
  5. Crash.

The crash callback is:

GPU_texture_free(GPUTexture * tex) Line 1991	C
radial_control_cancel(bContext * C, wmOperator * op) Line 2804	C
radial_control_modal(bContext * C, wmOperator * op, const wmEvent * event) Line 3026	C
wm_handler_operator_call(bContext * C, ListBase * handlers, wmEventHandler * handler_base, wmEvent * event, PointerRNA * properties, const unsigned char * kmi_idname) Line 2018	C
wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2806	C
wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2854	C
wm_event_do_handlers(bContext * C) Line 3283	C

The error is in line 1991 in function GPU_texture_freebecause textis NULL

Last source coded compiled at 20/07/2020 10:35 To reproduce: 1) Open 2D Template. 2) Draw a line. 3) Enter in Sculpt mode. 4) Press `F` and change radius. 5) Crash. The crash callback is: ``` GPU_texture_free(GPUTexture * tex) Line 1991 C radial_control_cancel(bContext * C, wmOperator * op) Line 2804 C radial_control_modal(bContext * C, wmOperator * op, const wmEvent * event) Line 3026 C wm_handler_operator_call(bContext * C, ListBase * handlers, wmEventHandler * handler_base, wmEvent * event, PointerRNA * properties, const unsigned char * kmi_idname) Line 2018 C wm_handlers_do_intern(bContext * C, wmEvent * event, ListBase * handlers) Line 2806 C wm_handlers_do(bContext * C, wmEvent * event, ListBase * handlers) Line 2854 C wm_event_do_handlers(bContext * C) Line 3283 C ``` The error is in line `1991` in function `GPU_texture_free`because `text`is `NULL`
Author
Member

Added subscriber: @antoniov

Added subscriber: @antoniov
Author
Member

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

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

Added subscribers: @fclem, @Jeroen-Bakker

Added subscribers: @fclem, @Jeroen-Bakker
Author
Member

I could add a check to avoid the free if the texture is NULL, but I prefer @fclem or @Jeroen-Bakker do the fix because they now better than me that area of the code.

I could add a check to avoid the free if the texture is NULL, but I prefer @fclem or @Jeroen-Bakker do the fix because they now better than me that area of the code.
Author
Member

Proposed fix:

index f0cd1add48b..d1f65b6271b 100644
    - a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2799,7 +2799,9 @@ static void radial_control_cancel(bContext *C, wmOperator *op)
    * new value is displayed in sliders/numfields */

WM_event_add_notifier(C, NC_WINDOW, NULL);

 
- GPU_texture_free(rc->texture);
+  if (rc->texture != NULL) {
+    GPU_texture_free(rc->texture);
+  }
 

MEM_freeN(rc);

 }
Proposed fix: ```diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f0cd1add48b..d1f65b6271b 100644 - a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2799,7 +2799,9 @@ static void radial_control_cancel(bContext *C, wmOperator *op) * new value is displayed in sliders/numfields */ ``` WM_event_add_notifier(C, NC_WINDOW, NULL); ``` - GPU_texture_free(rc->texture); + if (rc->texture != NULL) { + GPU_texture_free(rc->texture); + } ``` MEM_freeN(rc); ``` } ```
Author
Member

Added subscriber: @filedescriptor

Added subscriber: @filedescriptor

This issue was referenced by 9016a29f19

This issue was referenced by 9016a29f194194085acfd937f31b80be0f1b0c8e
Author
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Antonio Vazquez self-assigned this 2020-07-20 15:23:38 +02: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#79107
No description provided.