Re: Can I make a IM Module resident?

Sorry to bother you again. Does it mean, if I create an instance of this type within my immodule, then my module will never be unloaded? Because im_module_exit will never be called if there is an instance living, but the instance must be destroyed within im_module_exit. Looks like a black hole :-)

James Su

Owen Taylor wrote:

On Sun, 2003-03-30 at 21:32, James Su wrote:
I tried to use g_type_module_register_type () to register my class. This time, the application is never crashed, but the IM module is never unloaded. What's the matter with it?

As long as there is an instance of a type, the module implementing
that type won't be unloaded. Maybe that is your problem.


Owen Taylor wrote:

On Fri, 2003-03-28 at 03:31, James Su wrote:

Oh, I see. But the interface of this function is different with the static one, could you please give me some hint on how to use it?

The GTypeInfo parameter is replaced by a GTypePlugin pointer. Could you please tell me how can I convert a GTypeInfo into GTypePlugin?
The idea of GTypePlugin is that you provide information to GObject
as to how to load your type when necessary.

However, you don't need to provide your own GTypePlugin or
use g_type_register_dynamic() directly... what the GTypeModule parameter passed to your init() is is basically an
implementation of GTypePlugin that is already set up to for you

Just use g_type_module_register_type() rather than g_type_register_static(). There are multiple examples of this in the provided input modules, or for more examples, you can look at the theme engines in the gtk-engines/ modules. (They
generally register two types .. one GtkStyle type and one
GtkRcStyle type.)

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