[2.77a - 2.78] Removal of custom icon previews during add-on unregister crashes Blender #49829
Labels
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#49829
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Linux Mint 18, GTX 660 Ti
Blender Version
Broken: 2.77a.abf6f08; 2.78.4bb1e22
Short description of error
If any custom icon is currently visible in Blender window, then Blender crashes while add-on is being unregistred.
Exact steps for others to reproduce the error
ZIP file:
Changed status to: 'Open'
Added subscriber: @simon_lusenc
Added subscriber: @mont29
Confirmed, think problem comes from deferred loading of previews from files…
Happy to see I finally made proper bug report, which can be reproduced.
Btw I am also experiencing another problem with previews. That icons get randomly lost after some time (they simply don't show in UI anymore), is it possible to be tided to this or?
Added subscriber: @BrendonMurphy
hi, the addon here should be in it's own folder, not a single file with an icons folder dropped into blenders file structure.
my_folder/init.py /icons is the right structure.
for the correct way to use icons please see mesh_tinycad addon, I'm unable to reproduce this crash with mesh_tinycad
try this & let us know if it still crashes
@BrendonMurphy afaict, your comparison is wrong, mesh-tiny-cad does not have any 'static' panel always visible, showing custom icons right? it’s only in 'Special' W menu?
Issue here is when you unregister an addon (i.e. remove its custom icons) while those custom icons are being lazily loaded by UI code (because this loading happens in a thread iirc, which means it can be using custom icons data while it’s being cleaned out), at least that what I’m guessing until I investigate properly the issue. ;)
@mont29
tested the file & was able to reproduce only if I pressed reg/unreg the addon multiple times as fast as I could. pressing reg/unreg multiple times at a reasonable rate, say 0.5 second gap, the crash does not occur. I think what happens here is the Button Mashing is too quick for the addon to reload the custom icons.
I tested some other panel addons that use custom icons with no conclusion yet.
I just wonder is Button Mashing the reg/unreg of an addon usual use & expected use. ;)
@BrendonMurphy it depends on add-on and on how much and many custom icons are used and visible at the time of reg/unreg. I have add-on which has around 20 custom icons usages in tool shelf so I get to crash with that add-on quicker usually after 1-2 reg/unreg presses.
@simon_lusenc hi, sorry to be on your case here seemingly ;)
currently there is a delay when loading custom icons on first load.
I enable your test addon (in it's own folder using init.py), when I click the tab to open the panel the icons incrementally load. You can see it, they load one after the other taking maybe 1 second to populate the menu. From here they are loaded & switching tabs does not incur the "lag".
I'm thinking that the reg/unreg really quick beats this time, so blender tries to grab the icons & in the middle tries to grab them again, causing the crash.
This is prevented by taking your time & not pushing the current limitations,
I can easily reproduce this crash & also easily not crash here by not smashing the reg/unreg button.
Also I noticed in wazou's speedflow addon, which also has custom icons within a toolshelf panel, this is handled somewhat better. It has an option in addons preferences to display the custom icon panel. When addons preferences are saved as "use panel" the panel is on by default when you start blender, however if you reg/unreg the addon, the panel is not displayed until you re-activate it in the addons preferences.
To summarize, whilst there is an issue & a crash here, it's preventable.
i feel here the crash is some what forced by the user.
It's not usual behavior to enable/disable the same addon in fast succession. Don't do that ;)
The method used by wazou, whilst I tested, I did not examine the code, that said, it's impossible to reproduce this crash, using his code.
This issue was referenced by
5f0933f07a
@BrendonMurphy Yep I know to that if I will slowly enable/disable addon that crash won't happen, but that's not really a solution :)
Well I myself went aroound this the way:
I am not removing previews at all on unregister (they are kept in module dictionary variable for reuse) and if user again enables add-on preview is still accessible and rather than creating whole previews again I just reload images. The only downside is that preview collection is never cleared until you close Blender, but shouldn't be noticeable problem for user.
Another solution popped up during writing this post, that on each register I could create new preview collection and once new collection is created and used by UI I can in peace delete old collection hopefully without a crash.
However I still think that this "bug" should be take care of at some point ;)
Changed status from 'Open' to: 'Resolved'