RE: [gtk-list] Re: querying object args and gtk+ class initialis



>> 
>> Paradoxically though, gtk_args_query() contains the following snippet of
>> code...
>> 
>>   g_return_val_if_fail (arg_info_hash_table != NULL, NULL);
>> 
>>   /* make sure the types class has been initialized, because
>>    * the argument setup happens in the gtk_*_class_init() functions.
>>    */
>>   gtk_type_class (class_type);
>> 
>> ie it wants to call gtk_type_class() to ensure that class initialisation is
>> done, but unless some class has been previously initialised through some
>> other
>> path of execution it can never get that far, as it will bomb out due to
>> arg_info_hash_table being uninitialised. Indeed, when the call to
>> gtk_type_class() is uncommented in my code fragment above, the error goes
>> away,
>> as the call results in object_arg_info_ht being initialised.
>> 
>> To me, all of this looks like a bit of a buglet.
> [...]
> 
> yeah, you're absolutely correct, i added that line
>>   gtk_type_class (class_type);
> when we had a similar problem with signals, where a query function needed
> the class to be initialized, and didn't really think about the hash table
> constrains of the argument code.
> 
> the proper fix would be:
> 
> @@ gtkarg.c:gtk_args_query
> -  /* make sure the types class has been initialized, because
> -   * the argument setup happens in the gtk_*_class_init() functions.
> -   */
> -  gtk_type_class (class_type);
> 
> @@ gtkarg.h:gtk_args_query
> +  /* make sure the types class has been initialized, so a
> +   * arg_info_hash_table != NULL is passed into this function
> +   */
>  GtkArg*         gtk_args_query           (GtkType       class_type,
> 
> @@ gtkcontainer.h:gtk_container_query_child_args
> +  gtk_type_class (class_type);
> +
>    return gtk_args_query (class_type, container_child_arg_info_ht, arg_flags,
> n_args);
> 
> @@ gtkobject.h:gtk_object_query_args
> +  gtk_type_class (class_type);
> +
>    return gtk_args_query (class_type, object_arg_info_ht, arg_flags, n_args);
> 

Great, those patches look like they'll do the trick. However I've not
encountered the function gtk_container_query_child_args before. So, what's the
difference between an ordinary arg, and a "child_arg" of a container? If the
answer is long, a pointer to something to read would be fine.

----------------------------------
Michael Beach
mailto:michaelb@ieee.org
http://www.zip.com.au/~mbeach

It is interesting to note that before the advent of Microsoft Windows,
`GPF' was better known for its usage in plumbing: "Gallons Per Flush" 
-- dedmonds@aw.sgi.com (Dean Edmonds)
----------------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]