Page MenuHome

Fix T80035: Fix crash switching/adding scenes
AbandonedPublic

Authored by Philipp Oeser (lichtwerk) on Aug 24 2020, 12:54 PM.

Details

Summary

Caused by rB263148dbacc4: Depsgraph: refactor tagging after time changes

A depsgraph's TimeSourceNode can be NULL for a depsgraph which hasnt been build all the way [these only get added in build_scene_render() or build_view_layer()]. This seems valid for inactive scenes.

But DEG_time_tag_update is looping over all depsgraphs -- also the ones of inactive scenes, so this is why DEG_graph_time_tag_update would get into the situation of trying to access a NULL TimeSourceNode.

So I think a valid solution is to permit depsgraphs which dont have a timesource node in 'tag_time_source()', just do nothing and continue happily.

Diff Detail

Repository
rB Blender
Branch
master
Build Status
Buildable 9749
Build 9749: arc lint + arc unit

Event Timeline

Philipp Oeser (lichtwerk) requested review of this revision.Aug 24 2020, 12:54 PM
Philipp Oeser (lichtwerk) created this revision.

I think tag_time_source should just not do anything if there is no time source node. So the check should be moved there.

Sergey Sharybin (sergey) requested changes to this revision.Aug 24 2020, 1:08 PM

This requires deeper investigation about which exact dependency graph is missing time source and why. They are not added conditionally, and are required for proper animation handling. So it is not obvious to me why dependency graph without time source is even considered valid.

This revision now requires changes to proceed.Aug 24 2020, 1:08 PM

This requires deeper investigation about which exact dependency graph is missing time source and why. They are not added conditionally, and are required for proper animation handling. So it is not obvious to me why dependency graph without time source is even considered valid.

If you open the file from T80035 [has three scenes Scene, Scene.001 and Scene.002 -- Scene.002 being the active]
Only Scene.002 depsgraph is fully built afaict [build_view_layer], this is correct, no?

But switching scenes, we are looping over all depsgraphs [even the ones of inactive scenes] and try to tag the timesource nodes... this is wrong, no?

Btw., you can easily reproduce, just add 2 new scenes in a default blender startup, save, reopen and switch to one of the other scenes --> Boom

move check to tag_time_source()

Philipp Oeser (lichtwerk) edited the summary of this revision. (Show Details)

Ok, so this makes it sound that the depsgraph is allocated but not yet built. Don't thin there is anything wrong with that, but with the current state (after Jacques's refactor) such situation will miss the animation update when the graph is built.

So think more proper would be to always allocate time source, in the Depsgraph's constructor, or something like this.

source/blender/depsgraph/intern/depsgraph.cc
109 ↗(On Diff #28090)

No need to do so, the time_source is available as a member.

Ok, so this makes it sound that the depsgraph is allocated but not yet built. Don't thin there is anything wrong with that, but with the current state (after Jacques's refactor) such situation will miss the animation update when the graph is built.

Not totally sure if this covers all situations, but in build_view_layer(aka "when the graph is built") the TimeSourceNode gets added, so that should take care of animation update as well then?

Existence of node does not mean it will enforce evaluation unless is tagged. The initial tags after builds are done in deg_graph_on_visible_update, which is called from AbstractBuilderPipeline::build_step_finalize with time update set to false. So I think the time updates will be missing with the current state of master branch + this patch, and a more complete fix is needed.

P1598 will fix the crash and will make it so time updates are properly done.

Probably @Jacques Lucke (JacquesLucke) would want to double-check.

P1598 will fix the crash and will make it so time updates are properly done.

I think always adding the time node is a good idea. I think we can also remove the find_time_source method then, the time_source data member is public anyway.

I think we can also remove the find_time_source method then, the time_source data member is public anyway.

Fine by me as well :) Just do it separately from this fix.

@Philipp Oeser (lichtwerk), do you mind double-checking the snippet form me and committing it? ;)

P1598 sounds like a plan, will abandon this thing then, thx for you time @Sergey Sharybin (sergey) and @Jacques Lucke (JacquesLucke)