On Sat, Nov 27, 2010 at 7:05 PM, Bruno Dilly <bdi...@profusion.mobi> wrote:
> On Sat, Nov 27, 2010 at 9:34 AM, Christopher Michael
> <cpmicha...@comcast.net> wrote:
>> What ?? You mean we cannot just pump out code in a hurry, not test it,
>> and hope it works ?? Blasphemy I say !! ;)
>>
>> Nice catch :) Btw, what about
>> elm_list_item_data_get(elm_list_selected_item_get()) ??? What happens
>> there when nothing is selected in the elm_list ? ;)
>
> if nothing is selected elm_list_selected_item_get() returns NULL
> so you'll have elm_list_item_data_get(NULL)
>
> Now every item function checks for item not being NULL and check
> widtype (or at least should), so it will return NULL after this checks
> using the macro ELM_WIDGET_ITEM_CHECK_OR_RETURN
>
> But I'm not going to check the code unless you explain me what is
> going wrong, give me a test, a backtrace, something...
>

I realized you're talking about the usage on elementary config. In
this case, if a list can have not selected items it really can go to a
strcmp(X, NULL), but I'm not sure if it's possible to have a "no
profile selected" situation. Anyway looks like the same approach is
used on other lists, like themes, engines...

glima, couldn't you verify if it's needed to add checks before these
strcmps, please ? =)

> Regards
>
>>
>> dh
>>
>> On 11/27/2010 02:32 AM, Enlightenment SVN wrote:
>>> Log:
>>>    come on people, if it can return null then you can't just blindly throw 
>>> it into strcmp and watch it segv.
>>>
>>> Author:       discomfitor
>>> Date:         2010-11-26 23:32:30 -0800 (Fri, 26 Nov 2010)
>>> New Revision: 55032
>>>
>>> Modified:
>>>    trunk/TMP/st/elementary/src/bin/config.c
>>>
>>> Modified: trunk/TMP/st/elementary/src/bin/config.c
>>> ===================================================================
>>> --- trunk/TMP/st/elementary/src/bin/config.c  2010-11-26 23:41:08 UTC (rev 
>>> 55031)
>>> +++ trunk/TMP/st/elementary/src/bin/config.c  2010-11-27 07:32:30 UTC (rev 
>>> 55032)
>>> @@ -718,11 +718,19 @@
>>>   {
>>>      Evas_Object *li;
>>>      const char *selection;
>>> +   const char *profile;
>>>
>>>      li = data;
>>>      selection = elm_list_item_data_get(elm_list_selected_item_get(li));
>>> +   profile = elm_profile_current_get();
>>>
>>> -   if (!strcmp(elm_profile_current_get(), selection))
>>> +   if (!profile)
>>> +     {
>>> +        fprintf(stderr, "No profile currently set!");
>>> +        return;
>>> +     }
>>> +
>>> +   if (!strcmp(profile, selection))
>>>        return;
>>>
>>>      elm_config_save(); /* dump config into old profile's data dir */
>>
>>
>> --
>> "If C gives you enough rope to hang yourself, then C++ gives you enough
>> rope to bind and gag your neighborhood, rig the sails on a small ship,
>> and still have enough rope to hang yourself from the yardarm"
>> - Anonymous quote from the The UNIX-HATERS Handbook
>>
>> ------------------------------------------------------------------------------
>> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
>> Tap into the largest installed PC base & get more eyes on your game by
>> optimizing for Intel(R) Graphics Technology. Get started today with the
>> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
>> http://p.sf.net/sfu/intelisp-dev2dev
>> _______________________________________________
>> enlightenment-devel mailing list
>> enlightenment-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>
>

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to