I am working a lot with uiDefBut and its variants, the docs say that when a block is defined with the same name as previously it deletes itself releasing all buttons as well.
What happens when buttons use images like the splash screen dialog ? Do they images get released too ?
I am using basically the poin variable of the button to load the image to display my own icons because I create an icon heavy interface. I know that Blender is releasing it resources on shut down and I load imaged the same way the splash dialogue does, although I dont use a template like it does its a direct
load. I am using this approach to design my own custom right click menu which will be icon based.
Is there anything I should be aware of ?
I paste how I create the buttons and load the images/icons. Morph here is a struct I use to represent an icon button, nothing special.
/* creates a button using the filename of a image file as icon ,
an operator that is triggered when button is clicked, position x,y
width, height and text for tooltip */
static hec_morph *hec_create_morph(uiBlock *block, hec_morph *morph)
{
//printf("calling EphMorph\n");
char image_filepath[256];
hec_find_image_path(morph->texture_path,image_filepath);
morph->ibuf = aci_if->bl_IMB_loadiffname(image_filepath, IB_rect, NULL);
if(morph->type=="operator")
{
morph->but = aci_if->bl_uiDefIconButO(block, UI_BTYPE_IMAGE, morph->operator_name, WM_OP_INVOKE_DEFAULT, ICON_NONE, morph->x, morph->y, morph->width, morph->height, "");
morph->but->poin = (char *)morph->ibuf;
}
if(morph->type=="default")
{
morph->but = aci_if->bl_uiDefBut(block, UI_BTYPE_IMAGE, 0, "", morph->x, morph->y, morph->width, morph->height, (char *)morph->ibuf,0.0,0.0,0,0, "");
morph->but->poin = (char *)morph->ibuf;
}
//but->tip = "";
return morph;
};
The code works fine but I am a bit worried about potential memory leaks