Hi,
I have been using FSlateDynamicImageBrush forever and now i sometimes get some crashes.
Debug points to this code in FSlateDynamicImageBrush.h:
// @Todo Slate - Hack: This is to address an issue where the brush created and a GC occurs before the brush resource object becomes referenced
// by the Slate resource manager. Don't add objects that are already in root set (and mark them as such) to avoid incorrect removing objects
// from root set in destructor.
if (!Object->IsRooted())
{
ensureMsgf(false, TEXT("This hack usually results in a crash during loading screens in slate. Please change any code that arrives here to not use FSlateDynamicImageBrush. In the case of loading screens, you can use FDeferredCleanupSlateBrush. Which correctly accounts for both GC lifetime, and the lifetime of the object through the slate rendering pipeline which may be several frames after you stop using it."));
Object->AddToRoot();
bRemoveResourceFromRootSet = true;
}
I am not using FSlateDynamicImageBrush in the context of loading screens at all, just regular pictures on 3D widgets.
Anyway i have replaced FSlateDynamicImageBrush by FDeferredCleanupSlateBrush and it works fine.
Another way was to use the same hack: precede all my calls with an “if source picture isn’t rooted then add it to root”.
So no real practical problem here, as soon as you are aware of it.
But anyone knows the difference ? Why all of a sudden should i stop using good old FSlateDynamicImageBrush and what does it mean for an object to be rooted ?
Should i never ever use FSlateDynamicImageBrush again ?
Cheers
Cedric