View Issue Details

IDProjectCategoryView StatusLast Update
0003906NoesisGUIC++ SDKpublic2025-01-21 18:44
ReporterMikhail Yanakayev Assigned Tosfernandez  
PrioritynormalSeveritycrash 
Status feedbackResolutionopen 
Product Version3.2.6 
Summary0003906: Application sometimes crashed inside DynamicTextureSource callback
Description

After DynamicTextureSource object deletion there still TextureRenderCallback can be called with garbage pointer as parameter

Steps To Reproduce

Create DynamicTextureSource object with render callback
Delete DynamicTextureSource object
Sometimes callback still called after object deletion that leads to crash

PlatformAny

Activities

jsantos

jsantos

2025-01-20 12:49

manager   ~0010277

We have been discussing this and your usage of DynamicTextureSource is fundamentally wrong. The callbacks of the DynamicTextureSource source are invoked in the render-thread. You are not allowed to use objects of the main thread in these callbacks. So you can't pass "this" to the parameter and you can't use Visual in this callback.

We need to understand more why you need a DynamicTextureSource and find an alternative.

Mikhail Yanakayev

Mikhail Yanakayev

2025-01-20 14:31

reporter   ~0010278

We're using animation inside the texture and have to show new state every frame, so using DynamicTexture for this

jsantos

jsantos

2025-01-20 18:02

manager   ~0010279

What do you need to render inside the texture? Another XAML ?

Mikhail Yanakayev

Mikhail Yanakayev

2025-01-20 18:44

reporter   ~0010280

We need to render 3d model in a menu. For this we're using Image with DynamicTextureSource as source. Then we render that model inside the texture and show it,

jsantos

jsantos

2025-01-20 18:53

manager   ~0010281

You don't need a DynamicTextureSource for that. You can render the model inside the texture and then use WrapTexture to create a Noesis::Texture given a low-level GPU texture handle.

Mikhail Yanakayev

Mikhail Yanakayev

2025-01-20 19:21

reporter   ~0010282

So after that we still can animate model and update its position every frame? Is it some sample of that?
Also, is there some right workaround in the case if we still need DynamicTextureSource to not face this crash?

jsantos

jsantos

2025-01-21 11:46

manager   ~0010283

Last edited: 2025-01-21 12:06

Using WrapTexture is the best way to achieve what you want because you are 100% in charge of creating and filling the texture per frame (not using Noesis, using your renderer). WrapTexture gives you a Noesis::Texture that wraps your low-level handle. This allows to use the texture in Noesis.

Are you using our GLRenderDevice?

There is not workaround for DynamicTextureSource because it was created for a different thing. You can't interact with objects belonging to the main thread inside DynamicTextureSource callbacks.

Mikhail Yanakayev

Mikhail Yanakayev

2025-01-21 12:23

reporter   ~0010284

We're using our own engine render device as base. But I understood - I'll try your method when we'll have a time.
Thank you.

jsantos

jsantos

2025-01-21 18:44

manager   ~0010286

If you are using your own render device, then you have a custom implementation of Noesis::Texture. Just expose a way to create a Noesis::Texture given a low-level texture handle. That should work.

Please, let me know if you need help with this. I am going to leave the ticket open for now.

Issue History

Date Modified Username Field Change
2025-01-16 12:47 Mikhail Yanakayev New Issue
2025-01-17 22:52 jsantos Assigned To => sfernandez
2025-01-17 22:52 jsantos Status new => assigned
2025-01-17 22:52 jsantos Target Version => 3.2.7
2025-01-20 12:49 jsantos Note Added: 0010277
2025-01-20 12:49 jsantos Target Version 3.2.7 =>
2025-01-20 12:49 jsantos Status assigned => feedback
2025-01-20 14:31 Mikhail Yanakayev Note Added: 0010278
2025-01-20 14:31 Mikhail Yanakayev Status feedback => assigned
2025-01-20 18:02 jsantos Note Added: 0010279
2025-01-20 18:02 jsantos Status assigned => feedback
2025-01-20 18:44 Mikhail Yanakayev Note Added: 0010280
2025-01-20 18:44 Mikhail Yanakayev Status feedback => assigned
2025-01-20 18:53 jsantos Note Added: 0010281
2025-01-20 18:53 jsantos Status assigned => feedback
2025-01-20 19:21 Mikhail Yanakayev Note Added: 0010282
2025-01-20 19:21 Mikhail Yanakayev Status feedback => assigned
2025-01-21 11:46 jsantos Note Added: 0010283
2025-01-21 11:46 jsantos Status assigned => feedback
2025-01-21 12:06 sfernandez Note Edited: 0010283
2025-01-21 12:23 Mikhail Yanakayev Note Added: 0010284
2025-01-21 12:23 Mikhail Yanakayev Status feedback => assigned
2025-01-21 18:44 jsantos Note Added: 0010286
2025-01-21 18:44 jsantos Status assigned => feedback