DynamicTextureSource crash in callback after deletion
Posted: 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:
Thanks!
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:
Code: Select all
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);
}