Page MenuHome

AssetBrowser : Fix Crash when marking assets from python.
ClosedPublic

Authored by Jeroen Bakker (jbakker) on Oct 19 2021, 1:04 PM.

Details

Summary

When using asset_mark function from a python script and afterwards updating the preview image,
a crash might happen. The preview image is also generated by the asset_mark function. This could happen
on a background thread, introducing potential synchronization issues.

This patch fixes this by separating the preview generation ID.asset_generate_preview from the mark as
asset ID.asset_mark.

Diff Detail

Repository
rB Blender

Event Timeline

Jeroen Bakker (jbakker) requested review of this revision.Oct 19 2021, 1:04 PM
Jeroen Bakker (jbakker) created this revision.
Jeroen Bakker (jbakker) retitled this revision from AssetBrowser : Crash when marking assets from python . to AssetBrowser : Fix Crash when marking assets from python ..Oct 19 2021, 1:09 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)
  • Description of the render_preview parameter.
Jeroen Bakker (jbakker) retitled this revision from AssetBrowser : Fix Crash when marking assets from python . to AssetBrowser : Fix Crash when marking assets from python..Oct 19 2021, 1:13 PM
Sybren A. Stüvel (sybren) requested changes to this revision.Oct 19 2021, 1:18 PM
Sybren A. Stüvel (sybren) added inline comments.
source/blender/editors/asset/ED_asset_mark_clear.h
37–44

I really like that this is now independent of the context :)

42

is → might be

Whether this is done in a background thread or not depends on the ID type of the asset.

source/blender/makesrna/intern/rna_ID.c
676

Add a negation -- the function should return if it cannot mark as asset, not when it can.

This revision now requires changes to proceed.Oct 19 2021, 1:18 PM
Jeroen Bakker (jbakker) edited the summary of this revision. (Show Details)Oct 19 2021, 2:03 PM
Jeroen Bakker (jbakker) marked an inline comment as done.
  • Spliced the python function into asset_mark and asset_generate_preview.
This revision is now accepted and ready to land.Oct 19 2021, 4:04 PM