No, it doesn't need to be freed at every unrealize.
stringlist will stay same until item style changes so
realize/unrealize do not change the string list.
So this is more optimized way of doing it.

Daniel Juyung Seo (SeoZ)

On Fri, Apr 6, 2012 at 9:21 PM, Hyoyoung Chang <hyoyo...@gmail.com> wrote:
> On Fri, Apr 6, 2012 at 4:10 PM, Enlightenment SVN
> <no-re...@enlightenment.org> wrote:
>> Log:
>> elm genlist: Get the stringlist only when it does not exist. Free the 
>> stringlist when we change the item class.
>>
>> Author:       seoz
>> Date:         2012-04-06 00:10:29 -0700 (Fri, 06 Apr 2012)
>> New Revision: 69946
>> Trac:         http://trac.enlightenment.org/e/changeset/69946
>>
>> Modified:
>>  trunk/elementary/src/lib/elm_genlist.c
>>
>> Modified: trunk/elementary/src/lib/elm_genlist.c
>> ===================================================================
>> --- trunk/elementary/src/lib/elm_genlist.c      2012-04-06 07:10:26 UTC (rev 
>> 69945)
>> +++ trunk/elementary/src/lib/elm_genlist.c      2012-04-06 07:10:29 UTC (rev 
>> 69946)
>> @@ -1904,7 +1904,8 @@
>>         const Eina_List *l;
>>         const char *key;
>>
>> -        *source = elm_widget_stringlist_get(edje_object_data_get(target, 
>> "texts"));
>> +        if (!(*source))
>> +          *source = elm_widget_stringlist_get(edje_object_data_get(target, 
>> "texts"));
>>         EINA_LIST_FOREACH(*source, l, key)
>>           {
>>              if (parts && fnmatch(parts, key, FNM_PERIOD))
>> @@ -2010,7 +2011,8 @@
>>         const char *key;
>>         char buf[4096];
>>
>> -        *source = elm_widget_stringlist_get(edje_object_data_get(target, 
>> "states"));
>> +        if (!(*source))
>> +          *source = elm_widget_stringlist_get(edje_object_data_get(target, 
>> "states"));
>>         EINA_LIST_FOREACH(*source, l, key)
>>           {
>>              if (parts && fnmatch(parts, key, FNM_PERIOD))
>> @@ -2171,8 +2173,9 @@
>>         if (it->flipped)
>>           {
>>              edje_object_signal_emit(VIEW(it), "elm,state,flip,enabled", 
>> "elm");
>> -             it->item->flip_contents =
>> -               elm_widget_stringlist_get(edje_object_data_get(VIEW(it), 
>> "flips"));
>> +             if (!(it->item->flip_contents))
>> +               it->item->flip_contents =
>> +                  elm_widget_stringlist_get(edje_object_data_get(VIEW(it), 
>> "flips"));
>>              it->item->flip_content_objs =
>>                _item_mode_content_realize(it, VIEW(it),
>>                                           &it->item->flip_contents, NULL,
>> @@ -3271,8 +3274,9 @@
>>    assert(eina_list_count(it->item->deco_it_content_objs) == 0);
>>
>>    _item_text_realize(it, it->item->deco_it_view, &it->item->deco_it_texts, 
>> NULL);
>> -   it->item->deco_it_contents =
>> -     elm_widget_stringlist_get(edje_object_data_get(it->item->deco_it_view, 
>> "contents"));
>> +   if (!it->item->deco_it_contents)
>> +     it->item->deco_it_contents =
>> +        
>> elm_widget_stringlist_get(edje_object_data_get(it->item->deco_it_view, 
>> "contents"));
>>    it->item->deco_it_content_objs =
>>      _item_mode_content_realize(it, it->item->deco_it_view,
>>                                 &it->item->deco_it_contents, NULL,
>> @@ -3425,8 +3429,9 @@
>>
>>    _item_text_realize(it, it->deco_all_view, &it->item->deco_all_texts, 
>> NULL);
>>    if (it->flipped) edje_object_signal_emit(it->deco_all_view, 
>> "elm,state,flip,enabled", "elm");
>> -   it->item->deco_all_contents =
>> -     elm_widget_stringlist_get(edje_object_data_get(it->deco_all_view, 
>> "contents"));
>> +   if (!it->item->deco_all_contents)
>> +     it->item->deco_all_contents =
>> +        elm_widget_stringlist_get(edje_object_data_get(it->deco_all_view, 
>> "contents"));
>>    it->item->deco_all_content_objs =
>>      _item_mode_content_realize(it, it->deco_all_view,
>>                                 &it->item->deco_all_contents, NULL,
>> @@ -5100,6 +5105,34 @@
>>    if (_it->generation < _it->wd->generation) return;
>>    _it->itc = itc;
>>    _it->item->nocache_once = EINA_TRUE;
>> +
>> +   elm_widget_stringlist_free(_it->texts);
>> +   _it->texts = NULL;
>> +   elm_widget_stringlist_free(_it->contents);
>> +   _it->contents = NULL;
>> +   elm_widget_stringlist_free(_it->states);
>> +   _it->states = NULL;
>> +
>> +   if (_it->flipped)
>> +     {
>> +        elm_widget_stringlist_free(_it->item->flip_contents);
>> +        _it->item->flip_contents = NULL;
>> +     }
>> +   if (_it->item->deco_it_view)
>> +     {
>> +        elm_widget_stringlist_free(_it->item->deco_it_texts);
>> +        _it->item->deco_it_texts = NULL;
>> +        elm_widget_stringlist_free(_it->item->deco_it_contents);
>> +        _it->item->deco_it_contents = NULL;
>> +     }
>> +   if (_it->wd->decorate_all_mode)
>> +     {
>> +        elm_widget_stringlist_free(_it->item->deco_all_texts);
>> +        _it->item->deco_all_texts = NULL;
>> +        elm_widget_stringlist_free(_it->item->deco_all_contents);
>> +        _it->item->deco_all_contents = NULL;
>> +     }
>> +
>>    elm_genlist_item_update(it);
>>  }
>
> elm_genlist_item_item_class_update() calls _update_job()
> _update_job() calls item unrealizing.
> how about to move freeing widget string routine to item_unrealize?
>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> For Developers, A Lot Can Happen In A Second.
>> Boundary is the first to Know...and Tell You.
>> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>> http://p.sf.net/sfu/Boundary-d2dvs2
>> _______________________________________________
>> enlightenment-svn mailing list
>> enlightenment-...@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
> ------------------------------------------------------------------------------
> For Developers, A Lot Can Happen In A Second.
> Boundary is the first to Know...and Tell You.
> Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
> http://p.sf.net/sfu/Boundary-d2dvs2
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to