Fix crash on Android when loading mesh with SDF data

This commit is contained in:
Wojtek Figat
2025-10-07 18:09:18 +02:00
parent fc1451254d
commit f8dbf363b6
2 changed files with 8 additions and 0 deletions

View File

@@ -33,12 +33,14 @@ class StreamModelSDFTask : public GPUUploadTextureMipTask
{
private:
WeakAssetReference<Model> _asset;
FlaxStorageReference _dataRef;
FlaxStorage::LockData _dataLock;
public:
StreamModelSDFTask(Model* model, GPUTexture* texture, const Span<byte>& data, int32 mipIndex, int32 rowPitch, int32 slicePitch)
: GPUUploadTextureMipTask(texture, mipIndex, data, rowPitch, slicePitch, false)
, _asset(model)
, _dataRef(model->Storage)
, _dataLock(model->Storage->Lock())
{
}
@@ -59,6 +61,7 @@ public:
void OnEnd() override
{
_dataLock.Release();
_dataRef = FlaxStorageReference();
// Base
GPUUploadTextureMipTask::OnEnd();

View File

@@ -13,6 +13,11 @@ private:
FlaxStorage* _storage;
public:
FlaxStorageReference()
: _storage(nullptr)
{
}
FlaxStorageReference(FlaxStorage* storage)
: _storage(storage)
{