View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002306 | NoesisGUI | Unreal | public | 2022-03-10 13:38 | 2022-03-17 21:25 |
Reporter | jsantos | Assigned To | hcpizzi | ||
Priority | normal | Severity | crash | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Product Version | 3.1.2 | ||||
Target Version | 3.1.4 | Fixed in Version | 3.1.4 | ||
Summary | 0002306: Unreal Android build crash when NotifyChanged on Image is called | ||||
Description | In my xaml, I try to bind an image to a Texture2D variable in NoesisView: <!-- some layout --> <Image Grid.Column="3" Width="32" Height="32" Margin="221,30,182,30"> <Image.Source> <Binding Path="TestIcon"/> </Image.Source> </Image> <!-- some layout --> Then I have a button which sets TestIcon variable w/ NotifyChanged. So when i push it, the image swaps to another texture. Everything works fine in Unreal PIE (Play in Editor), but when i try to launch it on android, the app crashes whenever i press the button. The crash also happens when the button simply sends a NotifyChanged on that PropertyName. Worth noting is other TextBinding works fine. Checking UE log, I don't see any related error before and after the crash: LogPlayLevel: --------- beginning of crash LogPlayLevel: Took 0.6975239s to run adb.exe, ExitCode=0 LogPlayLevel: Running: C:\Users\AnLe\AppData\Local\Android\Sdk\platform-tools\adb.exe -s 8e865750 logcat -d LogPlayLevel: Took 0.2529926s to run adb.exe, ExitCode=0 LogPlayLevel: ********** RUN COMMAND COMPLETED ********** LogPlayLevel: BUILD SUCCESSFUL | ||||
Steps To Reproduce | My Project Version: - UE 4.27.2 - NoesisGUI-UE4.27-3.1.2-Indie Android Studio version 4.0 config, per Unreal document guidance: - SDK: 30.0.3 / 29.0.2 / 28.0.3 - NDK: 21.4.7075529 - CMake: 3.10.2.4988404 | ||||
Tags | No tags attached. | ||||
Platform | Any | ||||
I've found a problem where a check was accessing a null pointer if the texture property was set to none. Otherwise it is working for me. Could you try the attached patch and let us know if it works for you? 2306.patch (945 bytes)
Index: NoesisTypeClass.cpp =================================================================== --- NoesisTypeClass.cpp (revision 11264) +++ NoesisTypeClass.cpp (revision 11265) @@ -299,7 +299,7 @@ typedef Noesis::TextureSource* NoesisType; static Noesis::Ptr<Noesis::BaseComponent> ToNoesis(UObject* Value) { - check(Value->IsA<UTexture2D>()); + check(Value == nullptr || Value->IsA<UTexture2D>()); return NoesisCreateComponentForUTexture((UTexture2D*)Value); } static UObject* ToUnreal(Noesis::BaseComponent* Value) @@ -318,7 +318,7 @@ typedef Noesis::TextureSource* NoesisType; static Noesis::Ptr<Noesis::BaseComponent> ToNoesis(UObject* Value) { - check(Value->IsA<UTextureRenderTarget2D>()); + check(Value == nullptr || Value->IsA<UTextureRenderTarget2D>()); return NoesisCreateComponentForUTexture((UTextureRenderTarget2D*)Value); } static UObject* ToUnreal(Noesis::BaseComponent* Value) |
|
I have another patch for you to try. I think I was able to reproduce it this time. NoesisRenderDevice.cpp.patch (2,478 bytes)
Index: NoesisRenderDevice.cpp =================================================================== --- NoesisRenderDevice.cpp (revision 11261) +++ NoesisRenderDevice.cpp (working copy) @@ -911,21 +911,33 @@ // Usually the RHI resource is ready when we create the texture. // However, when we are hot-reloading a texture, UE4 enqueues the // creation to the render thread, so we must do the same. - ENQUEUE_RENDER_COMMAND(FNoesisInstance_InitRenderer) - ( - [Texture, Resource](FRHICommandListImmediate&) - { - FTexture2DRHIRef TextureRef = Resource->GetTexture2DRHI(); - if (TextureRef) + FTexture2DRHIRef TextureRef = Resource->GetTexture2DRHI(); + if (TextureRef) + { + check(Texture->Width == TextureRef->GetSizeX()); + check(Texture->Height == TextureRef->GetSizeY()); + check(Texture->NumMipMaps == TextureRef->GetNumMips()); + Texture->ShaderResourceTexture = TextureRef; + SetTextureFormat(Texture, TextureRef->GetFormat()); + } + else + { + ENQUEUE_RENDER_COMMAND(FNoesisInstance_InitRenderer) + ( + [Texture, Resource](FRHICommandListImmediate&) { - check(Texture->Width == TextureRef->GetSizeX()); - check(Texture->Height == TextureRef->GetSizeY()); - check(Texture->NumMipMaps == TextureRef->GetNumMips()); - Texture->ShaderResourceTexture = TextureRef; - SetTextureFormat(Texture, TextureRef->GetFormat()); + FTexture2DRHIRef TextureRef = Resource->GetTexture2DRHI(); + if (TextureRef) + { + check(Texture->Width == TextureRef->GetSizeX()); + check(Texture->Height == TextureRef->GetSizeY()); + check(Texture->NumMipMaps == TextureRef->GetNumMips()); + Texture->ShaderResourceTexture = TextureRef; + SetTextureFormat(Texture, TextureRef->GetFormat()); + } } - } - ); + ); + } } else if (InTexture->IsA<UTextureRenderTarget2D>()) { @@ -1304,8 +1316,11 @@ { FNoesisTexture* Texture = (FNoesisTexture*)(Batch.pattern); FRHITexture* PatternTexture = Texture->ShaderResourceTexture; - FRHISamplerState* PatternSamplerState = SamplerStates[Batch.patternSampler.v]; - PixelShader->SetPatternTexture(*RHICmdList, PatternTexture, PatternSamplerState); + if (PatternTexture != nullptr) + { + FRHISamplerState* PatternSamplerState = SamplerStates[Batch.patternSampler.v]; + PixelShader->SetPatternTexture(*RHICmdList, PatternTexture, PatternSamplerState); + } } } |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2022-03-10 13:38 | jsantos | New Issue | |
2022-03-10 13:38 | jsantos | Description Updated | |
2022-03-10 13:38 | jsantos | Assigned To | => hcpizzi |
2022-03-10 13:38 | jsantos | Status | new => assigned |
2022-03-10 13:39 | jsantos | Target Version | => 3.1.4 |
2022-03-10 13:39 | jsantos | Product Version | 3.1.3 => 3.1.2 |
2022-03-11 13:16 | hcpizzi | Note Added: 0007861 | |
2022-03-11 13:16 | hcpizzi | File Added: 2306.patch | |
2022-03-11 13:17 | hcpizzi | Status | assigned => feedback |
2022-03-14 17:27 | hcpizzi | Note Added: 0007863 | |
2022-03-14 17:27 | hcpizzi | File Added: NoesisRenderDevice.cpp.patch | |
2022-03-17 21:25 | sfernandez | Status | feedback => resolved |
2022-03-17 21:25 | sfernandez | Resolution | open => fixed |
2022-03-17 21:25 | sfernandez | Fixed in Version | => 3.1.4 |