From fb873f7b3de891c36a970d6d8059e3f2e8ac9a16 Mon Sep 17 00:00:00 2001 From: Harald Steinlechner Date: Mon, 21 Dec 2020 12:54:29 +0100 Subject: [PATCH] ResourceManagement: turned exn into warning temporarily to track down bug https://github.com/vrvis/PRo3D/issues/3 --- .../ResourceManagement.fs | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/Aardvark.Base.Rendering/ResourceManagement.fs b/src/Aardvark.Base.Rendering/ResourceManagement.fs index a00e2c007..364a31933 100644 --- a/src/Aardvark.Base.Rendering/ResourceManagement.fs +++ b/src/Aardvark.Base.Rendering/ResourceManagement.fs @@ -211,23 +211,25 @@ type Resource<'h, 'v when 'v : unmanaged>(kind : ResourceKind) = member private x.PerformUpdate(token : AdaptiveToken, t : RenderToken) = if refCount <= 0 then - failwithf "[Resource] cannot update unreferenced resource" - - let h = x.Create(token, t,current) - info <- x.GetInfo h - setHandle x h - - match current with - | Some old when Unchecked.equals old h -> - t.InPlaceResourceUpdate(kind) - - | Some old -> - current <- Some h - t.ReplacedResource(kind) - - | None -> - current <- Some h - t.CreatedResource(kind) + // [hs 21.12.2020] was (and should be) exn. https://github.com/vrvis/PRo3D/issues/3 + // untill no artificial repro is found, we need to go with this. + Log.warn "[Resource] cannot update unreferenced resource (refCount = %d, x.IsDisposed = %b, th = %A)" refCount x.IsDisposed th + else + let h = x.Create(token, t,current) + info <- x.GetInfo h + setHandle x h + + match current with + | Some old when Unchecked.equals old h -> + t.InPlaceResourceUpdate(kind) + + | Some old -> + current <- Some h + t.ReplacedResource(kind) + + | None -> + current <- Some h + t.CreatedResource(kind) member x.AddRef() =