Fix #140781: Crash on "Adjust Pose asset" from Asset Browser
See: https://projects.blender.org/blender/blender/issues/140781#issuecomment-1608861.
This commit is contained in:
@@ -638,6 +638,9 @@ static wmOperatorStatus pose_asset_modify_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bAction *action = get_action_of_selected_asset(C);
|
||||
BLI_assert_msg(action, "Poll should have checked action exists");
|
||||
/* Get asset now. Asset browser might get tagged for refreshing through operations below, and not
|
||||
* allow querying items from context until refreshed, see #140781. */
|
||||
const asset_system::AssetRepresentation *asset = CTX_wm_asset(C);
|
||||
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Object *pose_object = CTX_data_active_object(C);
|
||||
@@ -655,7 +658,7 @@ static wmOperatorStatus pose_asset_modify_exec(bContext *C, wmOperator *op)
|
||||
bke::asset_edit_id_save(*bmain, action->id, *op->reports);
|
||||
}
|
||||
|
||||
asset::refresh_asset_library_from_asset(C, *CTX_wm_asset(C));
|
||||
asset::refresh_asset_library_from_asset(C, *asset);
|
||||
WM_main_add_notifier(NC_ASSET | ND_ASSET_LIST | NA_EDITED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
Reference in New Issue
Block a user