[Glade-users] cannot register existing type

Tristan Van Berkom tristan.van.berkom at gmail.com
Thu Jan 30 12:29:16 UTC 2014


One more thing I should have mentioned, and failed to mention
(sometimes you ignore the
obvious because it's just too obvious).


Are these widgets linking to the GTK+2 library by any chance ?

I assume when you made the switch from Glade 3.8 (GTK+2) and moved
to Glade 3.14 (GTK+3 and parallel installable with Glade 3.8) - you also
ported your widgets to GTK+3, correct ?

If you try to load anything linking against GTK+2 with Glade >= 3.10,
it will most certainly not work (for GTK+2 you must absolutely use
Glade 3.8).

Cheers,
    -Tristan




On Thu, Jan 30, 2014 at 9:22 PM, Tristan Van Berkom
<tristan.van.berkom at gmail.com> wrote:
> On Thu, Jan 30, 2014 at 9:10 PM, Andrea Zagli <azagli at libero.it> wrote:
>> Il giorno mer 29 gen 2014 18:01:07 CET, Tristan Van Berkom ha scritto:
>>
>>> On Wed, Jan 29, 2014 at 7:34 PM, Andrea Zagli <azagli at libero.it> wrote:
>>>>
>>>> i have 2 custom widgets: GtkMaskedEntry and GtkDateEntry
>>>>
>>>> GtkDateEntry is a GtkBin with inside GtkMaskedEntry
>>>>
>>>> i created catalogs and pixmaps to use them with glade (version 3.14.3);
>>>> but
>>>> when i try to insert widget GtkDateEntry inside a container (ex. GtkBox)
>>>> i
>>>> got the error
>>>>
>>>> GLib-GObject-WARNING **: cannot register existing type `GtkMaskedEntry'
>>>> (glade.exe:5052): GLib-CRITICAL **: g_once_init_leave: assertion `result
>>>> !=
>>>> 0' failed
>>>> (glade.exe:5052): GLib-GObject-CRITICAL **: g_object_new: assertion
>>>> `G_TYPE_IS_OBJECT (object_type)' failed
>>>>
>>>> and glade crash (if i insert GtkMaskedEntry it works)
>>>>
>>>> in glade 3.8.x they works perfectly
>>>>
>>>> what could be the problem?
>>>
>>>
>>> Does one derive from the other ?
>>
>>
>> no
>>
>> as i said GtkDateEntry is derived from GtkBin with GtkHBox as child; inside
>> the GtkHBox there are a GtkMaskedEntry (derived from GtkEntry) and others
>> widgets
>
> That sort of explains it, so the GtkDateEntry contains GtkMaskedEntry widgets ?
>
> How come they are not in the same library ?
>
> You should be able to specify the libgtkdateentry.so library for your
> gtkmaskedentry.xml
> catalog - this will at least cause both catalogs to dlopen the same
> library - indirectly accessing
> the library which declared the gtkmaskedentry widgets :-/
>
> If you define a single catalog, declaring gtkmaskedentry before
> gtkdateentry - that should
> really solve this problem.
>
> I'm not sure how 3.8 would have worked better in this regard, this bug
> certainly has
> to do with how we dlopen both libraries - it would seem the dynamic
> linker is not
> sharing memory properly (or we are not requiring it to do so properly).
>
> Cheers,
>     -Tristan
>
>
>>
>>
>>
>>> If it does, the parent class should be defined before the child class
>>> inside
>>> the catalog.
>>>
>>> How is the catalog defined ? Are you linking to the module/library
>>> containing
>>> these widgets or are you faking the type using the "parent" xml attribute
>>> of
>>> the <glade-widget-class> tag ?
>>>
>>> If you can send us the catalog we could make a better guess at what's
>>> going
>>> wrong here.
>>
>>
>> attached
>>
>>
>>
>>> Also, a little besides the point: NEVER define custom widgets that are
>>> called
>>> GtkAnything, 'Gtk' is reserved for the GTK+ namespace, so as soon as GTK+
>>> decides to go ahead and declare a GtkDateEntry of its own, your code
>>> breaks.
>>>
>>> Call it PonyDateEntry, assuming your widget library or application is
>>> called Pony.
>>
>>
>>
>> yes i know :-(
>>
>>
>> thanks


More information about the Glade-users mailing list