After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 629326 - Re-registering a model shouldn't emit warning
Re-registering a model shouldn't emit warning
Status: RESOLVED FIXED
Product: GEGL
Classification: Other
Component: babl
git master
Other All
: Normal normal
: ---
Assigned To: Default Gegl Component Owner
Depends on:
Blocks:
 
 
Reported: 2010-09-10 22:19 UTC by Rupert Weber
Modified: 2010-12-20 21:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
babl-model.c: allow reregistering model w/o warning (1.34 KB, patch)
2010-09-10 22:19 UTC, Rupert Weber
none Details | Review
Handle reregister of models/formats/types (7.15 KB, patch)
2010-09-14 12:15 UTC, Rupert Weber
none Details | Review
Updated patch to catch conflicting id (8.70 KB, patch)
2010-09-19 13:33 UTC, Rupert Weber
none Details | Review
Extended patch to babl_component_new() (10.69 KB, patch)
2010-10-01 10:56 UTC, Rupert Weber
none Details | Review

Description Rupert Weber 2010-09-10 22:19:31 UTC
Created attachment 169996 [details] [review]
babl-model.c: allow reregistering model w/o warning

When re-registering a color model (which should be expected from extensions) babl emits a warning which in turn messes up the introspection DHTML.

The attached patch adds a check if the new model is different from the old (which would be bad) and only then emits the warning.

(So far the other functions (babl_format_new() etc.) just silently return the existing object if the names match.)
Comment 1 Rupert Weber 2010-09-14 12:15:37 UTC
Created attachment 170238 [details] [review]
Handle reregister of models/formats/types

Extended the duplicate check to formats and types.
Made conflicting registrations fatal.

Also fixed conflicting registrations for "Y'CbCr u8" which showed up through the new tests.

One thing I wasn't quite sure about: In model-ycbcr.c, the "Y'CbCr u8" format was registered with id BABL_YCBCR420. 
I removed the id, as it seems to be an error, but you might want to double-check that.
Comment 2 Rupert Weber 2010-09-19 13:33:30 UTC
Created attachment 170596 [details] [review]
Updated patch to catch conflicting id

Updated patch to catch duplicate registrations with different ids.
(See Bug 630061)
Comment 3 Rupert Weber 2010-10-01 10:56:20 UTC
Created attachment 171480 [details] [review]
Extended patch to babl_component_new()

Included duplicate checks for babl_component_new().

Note that bug 630061 needs to be fixed in order to run this successfully. Otherwise the new checks will throw an error on the attempted duplicate-but-different registration of "RGBA double".
Comment 4 Øyvind Kolås (pippin) 2010-12-20 21:14:20 UTC
commit 740baf02ac245496acc5807d723f06e50e30e853
Author: Rupert Weber <gimp@leguanease.org>
Date:   Fri Oct 1 02:18:53 2010 +0200

    allow reregistering but check for differences
    
    babl_model_new() emitted a warning when reregistering a model,
    babl_format_new(), babl_type_new(), and babl_component_new()
    quietly returned a preexisting object.
    
    Changed so that all four functions return the preexisting object
    if the new registration doesn't conflict, otherwise make the
    error fatal.
    
    (Fixed some conflicting and redundant registrations for
    "Y'CbCr u8" along the way)