DC-SWAT Forum

Полная версия: SDL_FreeSurface ?
Вы просматриваете yпpощеннyю веpсию форума. Пеpейти к полной веpсии.
i still got problems getting my isoBrowser app to work.
at least i made some progress: i am pretty sure now that i fill up the ram with all the button instances i create until the app freezes.

so my question is: how to free up some ram again?
i create buttons and load images into my buttons like:

b = DS.GUI_ButtonCreate(.....);
s = DS.GUI_SurfaceLoad(self.currentpath .. appname .. "/icon.jpg");
DS.GUI_ButtonSetNormalImage(b, s);
...etc...

then i add the button to a container named 'panel' on the screen:
DS.GUI_ContainerAdd(self.apps.panel, b);

this works well.

but i got NO IDEA how to free the ram i used for loading the images.
can anyone point me to the right direction here?
is there a way to "DS.SDL_FreeSurface( s );" somehow ?

"GUI_ContainerRemove" removes the container but doesn't free the ram right?
"GUI_WidgetErase" ?
"GUI_WidgetUpdate" ?

i am lost in endless loops of trial and error. Confused
any help is highly appreciated!!
DS.GUI_ContainerAdd(self.apps.panel, b);
DS.GUI_ObjectDecRef(DS.GUI_AnyToObject(b));

Then if you call GUI_ContainerRemove, widget deleted from memory.
whoa that was FAST!
i'll try this asap!
thank you VERY MUCH,good sir! Smile
dammmn. no luck here....

if i do it like this:
DS.GUI_ContainerAdd(self.apps.panel, b);
DS.GUI_ObjectDecRef(DS.GUI_AnyToObject(b));

the app won't even start and freezes the loading screen.
without DS.GUI_ObjectDecRef(DS.GUI_AnyToObject(b));
the app starts again.

b is definitely a button.
GUI_ContainerAdd adds it to the screen.
so nothing wrong there i'd say.

what could be the reason for DS.GUI_ObjectDecRef to freeze everything even BEFORE it is called?

EDIT: i am testing on nullDC. if that matters...
Yes, unfortunately I ran into the same problem and so far can not fix it Sad
In C, it works ...
You need to find another solution can not necessarily delete and create the button every time? Maybe its just a one time set up and use with different callbacks?

I would recommend you, move your application logic in a module, it will solve the problems with memory.
thanks again for your reply!
i'll think about another solution. it would be possible to create the buttons once and just update them with new callbacks, although.. i'd like to give every button it's own icon, and thats going to fill up the ram again, right?

i will give the module a try. that's probably too much for a script kiddie like me, but i'll give it a shot..

thanks for your time!
I will help you with the module.
(03.11.2011 07:22)SWAT писал(а): [ -> ]I will help you with the module.

Awesome!
i will clean up my code, take a look at the module sdk and let you know when/where i get stuck?
thank again!
I'm even more to say. I will propose to include your application in a new version of the DS, combining it with my application, it is still not completed yet. It would have saved me time and you do not have to rewrite the application for the new version of DS.
sounds even more awesome!
in this case i am going to refine the design as well!

so what works best for you: do you want me to try getting my app into a module? or do you want the cleaned up sources and port it yourself?
You can start writing the module, and later I'll give you a new SDK and the latest build of DS for the tests.
sorry for the delay. i am super busy with something else until sunday.
looking forward to some free time next week..!
It's okay, I understand you Smile
alright.back at it.

i wasted some time to get an environment up and running on os x.
i will get back to that later.

for now i got everything running on my bootcamps windows. the test module from your sdk compiles fine.
now i got one or two questions about the module in general..
i'll PM you later- after work........................
got a couple of things working now and i start to get an idea how to build the module!
man...debugging is so comfortable now within cygwin! really nice..!
Glad to hear it Smile
URL ссылки