Mikhail Yanakayev
Topic Author
Posts: 15
Joined: 20 Sep 2023, 12:13

DynamicTextureSource crash in callback after deletion

15 Jan 2025, 11:56

Hello,
We're using class inherited from DynamicTextureSource with callback on texture rendering. Problem is after this class deletion callback can still be called with garbage pointer inside second parameter. What's right procedure of deletion such classes with proper callback call cancellation?
Code below:
MyDynamicTextureSource::MyDynamicTextureSource(uint32_t width, uint32_t height) :
	Noesis::DynamicTextureSource(width, height, &DynamicTextureSourceCallback, this),
{
}

MyDynamicTextureSource::~MyDynamicTextureSource()
{
}

Noesis::Texture* MyTextureSource::DynamicTextureSourceCallback(Noesis::RenderDevice* device, void* user)
{
	DragonDynamicTextureSource* source = (DragonDynamicTextureSource*)user;
	Noesis::Visual* visual = Noesis::DynamicCast<Noesis::Visual*>(source->GetNodeParent()); //crash here

	MyRender(visual);
}
Thanks!
 
User avatar
jsantos
Site Admin
Posts: 4822
Joined: 20 Jan 2012, 17:18
Contact:

Re: DynamicTextureSource crash in callback after deletion

16 Jan 2025, 10:44

Could you please create a ticket for this? This was partially fixed in the Studio branch but we do still need a better solution.
 
Mikhail Yanakayev
Topic Author
Posts: 15
Joined: 20 Sep 2023, 12:13

Re: DynamicTextureSource crash in callback after deletion

16 Jan 2025, 12:50

Sure. Ticked has been created:
https://www.noesisengine.com/bugs/view.php?id=3906

Is there a chance that crash will not occur in 3.2.7 version? Or some workaround already exists maybe?
 
User avatar
jsantos
Site Admin
Posts: 4822
Joined: 20 Jan 2012, 17:18
Contact:

Re: DynamicTextureSource crash in callback after deletion

20 Jan 2025, 12:50

Let's continue the conversation in the created ticket. Your usage of DynamicTextureSource is not correct and we need to find an alternative.

Who is online

Users browsing this forum: No registered users and 8 guests