Does ptr_remove(PANEL*) removes bmap?

Posted By: Arrovs

Does ptr_remove(PANEL*) removes bmap? - 10/18/13 19:58

As perfect question can be. Please could i get some brightness?
Im often changing bmaps in my panels, but im confused what will happen at removing panels.Do i have to remove BMAP first or it will go together? Or i will fill up memory with bmaps when not doing it.
Posted By: Ch40zzC0d3r

Re: Does ptr_remove(PANEL*) removes bmap? - 10/18/13 20:15

Well it is a struct which contains a pointer to a struct.
So you have to remove both.
Posted By: Arrovs

Re: Does ptr_remove(PANEL*) removes bmap? - 10/18/13 21:01

did some tests, but i have feeling it remove bmap in some cases and in some dont.

PANEL* panel = pan_create("bmap = test.bmp", 1);
this seems to remove bmap too - atleast i dont see used memory growing when removing this.

PANEL* panel = pan_create("bmap = NULL", 1);
panel.bmap = test;
In this case it seems dont remove it.

So i need to be vary in situation like this
PANEL* panel = pan_create("bmap = test.bmp", 1);
ptr_remove(panel.bmap);
Because it seems im removing all images who now used test.bmp.

I have feeling pan_create makes global bmaps. So in first case it deletes panel, but possibly left bmap undeleted.
Posted By: Ch40zzC0d3r

Re: Does ptr_remove(PANEL*) removes bmap? - 10/18/13 21:15

Well, in this case its somethign different I believe.
Creating them dynamicly could change my theory, so why not use draw_quad with the bmap pointer and see if the bmap will stay or not?

If you do it like this:
Code:
PANEL* panel = pan_create("bmap = test.bmp", 1);
ptr_remove(panel);



You cant check for panel.bmap because the panel pointer is invalid after ptr_remove call.
Posted By: Arrovs

Re: Does ptr_remove(PANEL*) removes bmap? - 10/18/13 21:46

i tried what you said and it really removes bmap in this case
BMAP* bmap;
PANEL* panel = pan_create("bmap = testa_bilde.bmp", 1);
bmap = panel.bmap;

I then added this bmap to other panel and after removing first panel second left without bmap. So in this case it removes bmap too;

But in case i added bmap after creating;
PANEL* panel = pan_create("bmap = NULL", 1);
panel.bmap = bmap;
Removing panel didnt remove bmap.

So now i know it, but it will make all tracking harded for deleted and undeleted things.
© 2024 lite-C Forums