On Fri, Mar 25, 2011 at 2:03 PM, Carsten Haitzler <ras...@rasterman.com>wrote:

> On Mon, 14 Mar 2011 16:54:00 +0900 "Sung W. Park" <sung...@gmail.com>
> said:
>
>
> > ok, i guess it's not a bad idea to keep track of the objects created via
> the
> > gl object
> > and delete them during evas_gl_free.
> >
> > now, i'm not sure if i'm using Eina properly here but would something
> like
> > this work?
> >
> > struct _Evas_GL
> > {
> >    int         magic;
> >    Evas       *evas;
> >
> >    Eina_List  *contexts;
> >    Eina_List  *surfaces;
> > };
> >
> > .....
> > EAPI void
> > evas_gl_free(Evas_GL *evas_gl)
> > {
> >    Eina_List *l;
> >    Evas_GL_Context *ctx;
> >    Evas_GL_Surface *sfc;
> >
> >    ...
> >
> >    // Delete undeleted surfaces
> >    EINA_LIST_FOREACH(evas_gl->surfaces, l, sfc)
> >      {
> >         if (sfc)
> >            evas_gl_surface_destroy(evas_gl, sfc);
> >      }
> >    ...
> >
> >    free(evas_gl);
> >    evas_gl = NULL;
> > }
>
> no.. the way to do the  list free is more:
>
> while (evas_gl->surfaces)
>  evas_gl_surface_destroy(evas_gl, evas_gl->surfaces->data);
>
> (the surf destroy handles list removal for us so we know it'll remove the
> item
> we are looking at thus eventually draining the list to be empty)
>
>
sounds good. i'll go ahead and apply that.


> > EAPI void
> > evas_gl_surface_destroy(Evas_GL *evas_gl, Evas_GL_Surface *surf)
> > {
> >
> >    ...
> >
> >    // Call Engine's Surface Destroy
> >
> > evas_gl->evas->engine.func->gl_surface_destroy
> > (evas_gl->evas->engine.data.output, surf->data);
> >
> >    // Remove it from the list
> >    evas_gl->surfaces = eina_list_remove(evas_gl->surfaces, surf);
> >
> >    // Delete the object
> >    free(surf);
> >    surf = NULL;
> > }
> >
> > Thanks again!
> > Sung
>
>
> --
> ------------- Codito, ergo sum - "I code, therefore I am" --------------
> The Rasterman (Carsten Haitzler)    ras...@rasterman.com
>
>
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to