Re: gnome-build hanging (fwd)
- From: Gustavo Giráldez <gustavo giraldez gmx net>
- To: Jeroen Zwartepoorte <jeroen xs4all nl>
- Cc: Dave Camp <dave ximian com>, Gnome Devtools list <gnome-devtools gnome org>
- Subject: Re: gnome-build hanging (fwd)
- Date: 23 Aug 2002 00:14:32 -0300
Hello all,
Finally, the crash in anjuta2 crashing when clicking in glimmer after
closing the project has been solved. It turned out to be caused by a
line I had put to help me debug gbf-am-project with memprof. Anyway,
the problem was, just as I thought, that the module was registering
static data with the rest of the application (leaving a dangling pointer
when it was unloaded).
So, even if this particular issue is solved, there still remains the
general case: what to do if the module wants to share static data with
the application (e.g. a quark registration from a static string). In
this case, the module can't be unloaded.
I thought of two possible work arounds:
1) a quick and dirty solution would be to g_type_module_use() the
plugin, so the use count never drops to zero and unload is never called
(and neither is g_module_close). This can be done almost anywhere,
since it's easy given the module, a registered type or an instance of
those types. I.e.:
type = G_TYPE_FROM_INSTANCE (object);
plugin = g_type_get_plugin (type);
g_type_module_use (G_TYPE_MODULE (plugin));
2) the (IMHO) correct solution: to mark the module as resident with
g_module_make_resident(). I see two ways of doing this, and both
involve changing the glue code:
a) by exporting some special symbol in the module and checking for
its presence/value at load_plugin() time.
b) by providing a generalized module initialization function, and
leaving the choice to the module. This is mostly like
glue_register_components, but forcing its invocation at module
loading time. Currently, glue_register_components is only called on
second load of the module, since at the time the plugin is created,
plugin->module is not NULL. I don't know if this is intended or
accidental.
Both these solutions (a and b) would also require a small modification
in the *_get_type() functions (probably involving only modifications to
the boilerplate macros) to allow re-registration. I.e., instead of:
if (!type) {
/* fill in structure */
type = g_type_module_register_type (...);
}
do something like:
if (!type)
/* fill in structure */
if (!type || plugin)
type = g_type_module_register_type (...);
Otherwise, the types are marked as unloaded when unload (from
GTypeModule class) method is called, and this is not reset when calling
glue_register_components().
So, what do you people think?
Gustavo
On Thu, 2002-08-22 at 06:07, jeroen wrote:
> ---------- Forwarded message ----------
> Date: 21 Aug 2002 23:09:42 -0300
> From: "Gustavo [ISO-8859-1] Giráldez" <gustavo giraldez gmx net>
> To: Jeroen Zwartepoorte <jeroen xs4all nl>
> Subject: Re: gnome-build hanging
>
> Hi Jeroen,
>
> Well, I found out why we are getting these weird errors. The problem
> arises when the plugin is unloaded. The g_module_* reference section
> says you should never unload a module if the module registers static
> data with the rest of the application. This happens in many places
> apparently (though I can only identify the quark registration).
>
> I tried making the module permanent (with g_module_make_permanent), but
> then the glue code fails to register the type the second time you ask
> for a project object. I'm not very familiar with the glue code, so
> right now I can't tell why. I'll investigate further tomorrow morning.
> In the meantime, if you know how to solve this, I would like to know it
> too :-) Maybe you could mail Dave, as he'll probably know the answer
> offhand.
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]