Zitat von "Sven Neumann" <s...@gimp.org>:

> On Wed, 2010-04-21 at 12:33 +0200, Oliver Bandel wrote:
>
>> Example:
>>
>>
>> ==============================================
>> /*****************************************************************************/
>> /*  public functions
>> ********************************************************/
>>
>> GimpContext *
>> gimp_context_new (Gimp        *gimp,
>>                    const gchar *name,
>>                    GimpContext *template)
>> {
>>    GimpContext *context;
>>
>>    g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
>>    g_return_val_if_fail (name != NULL, NULL);
>>    g_return_val_if_fail (! template || GIMP_IS_CONTEXT (template), NULL);
>>
>>    context = g_object_new (GIMP_TYPE_CONTEXT,
>>                            "name", name,
>>                            "gimp", gimp,
>>                            NULL);
>>
>>    if (template)
>>      {
>>        context->defined_props = template->defined_props;
>>
>>        gimp_context_copy_properties (template, context,
>>                                      GIMP_CONTEXT_ALL_PROPS_MASK);
>>      }
>>
>>    return context;
>> }
>> ==============================================
>>
>> The test
>>    if( template )
>> makes only sense, if you can be sure that uninitialzed values
>> will definitely be NULL.
>
> "template" isn't uninitialized here.
[...]

To explain, what I meant:

The function, that calls   gimp_context_new()
gives template to gimp_context_new().
If THE CALLING function - for some reason - gives a non-NULL but
non valid pointer to  gimp_context_new(), shit happens.


Ciao,
    Oliver

_______________________________________________
Gimp-developer mailing list
Gimp-developer@lists.XCF.Berkeley.EDU
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

Reply via email to