Skip to content

Commit aa719f3

Browse files
committed
Update
1 parent 6d5213d commit aa719f3

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
83f9dfee3c40c31ab2319cc0cf94c0f754aadf483ffe4aa6de16b1413ddb83c8
1+
2c50ef2c68ccdf705767f11a94caf940e0339e4bd2261961b6ff807fd4c12e44

src/Files.App/ViewModels/UserControls/Previews/ShellPreviewViewModel.cs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ private unsafe bool ChildWindowToXaml(nint parent, UIElement presenter)
162162
];
163163

164164
Windows.Win32.Foundation.HRESULT hr = default;
165-
ComPtr<ID3D11Device> pD3D11Device = default;
166-
ComPtr<ID3D11DeviceContext> pD3D11DeviceContext = default;
167-
ComPtr<IDXGIDevice> pDXGIDevice = default;
168-
ComPtr<IDCompositionDevice> pDCompositionDevice = default;
169-
ComPtr<IDCompositionVisual> pChildVisual = default;
170-
ComPtr<IUnknown> pControlSurface = default;
165+
using ComPtr<ID3D11Device> pD3D11Device = default;
166+
using ComPtr<ID3D11DeviceContext> pD3D11DeviceContext = default;
167+
using ComPtr<IDXGIDevice> pDXGIDevice = default;
168+
using ComPtr<IDCompositionDevice> pDCompositionDevice = default;
169+
using ComPtr<IUnknown> pControlSurface = default;
170+
ComPtr<IDCompositionVisual> pChildVisual = default; // Don't dispose this one, it's used by the compositor
171171

172172
// Create the D3D11 device
173173
foreach (var driverType in driverTypes)
@@ -209,21 +209,15 @@ private unsafe bool ChildWindowToXaml(nint parent, UIElement presenter)
209209
outputLink = ContentExternalOutputLink.Create(compositor);
210210

211211
var target = outputLink.As<IDCompositionTarget>();
212-
213212
target.SetRoot((nint)pChildVisual.Get());
213+
214214
outputLink.PlacementVisual.Size = new(0, 0);
215215
outputLink.PlacementVisual.Scale = new(1 / (float)presenter.XamlRoot.RasterizationScale);
216216
ElementCompositionPreview.SetElementChildVisual(presenter, outputLink.PlacementVisual);
217217

218218
// Commit the all pending DComp commands
219219
pDCompositionDevice.Get()->Commit();
220220

221-
pControlSurface.Release();
222-
pDCompositionDevice.Release();
223-
pDXGIDevice.Release();
224-
pD3D11Device.Release();
225-
pD3D11DeviceContext.Release();
226-
227221
var dwAttrib = Convert.ToUInt32(true);
228222

229223
return

0 commit comments

Comments
 (0)