Skip to content

Commit e01b3cc

Browse files
authored
Merge pull request #6589 from minetoblend/fix/screenshot-drawnode-disposal
Fix disposal logic in `DrawableScreenshotterDrawNode`
2 parents f647eeb + 87a5c16 commit e01b3cc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

osu.Framework/Graphics/Visualisation/DrawableScreenshotter.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,16 @@ private void onRendered(IFrameBuffer frameBuffer)
8888
var targetDrawNode = Target.GenerateDrawNodeSubtree(frame, treeIndex, forceNewDrawNode);
8989

9090
if (targetDrawNode == null)
91+
{
92+
onImageReceived(null);
93+
94+
Expire();
9195
return null;
96+
}
97+
98+
// This looks a bit odd, but we essentially want a drawNode that we can safely dispose once we've rendered it.
99+
// This call will force the target drawable to recreate its drawNode subtree so the one we got should be completely detached.
100+
Target.GenerateDrawNodeSubtree(frame, treeIndex, forceNewDrawNode: true);
92101

93102
var drawNode = new DrawableScreenshotterDrawNode(this, targetDrawNode, sharedData, onRendered);
94103

0 commit comments

Comments
 (0)