Re: Can I make a IM Module resident?



On Tue, 2003-04-01 at 00:55, James Su wrote:
> Hi,
> 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 :-)

I think you have to figure out for yourself a policy of when you
get rid of that object. For instance, you could get rid of it
when the last GtkIMContext from your module was destroyed. Or in some
timeout 5 minutes after the last GtkIMContext was destroyed or ...

But there is no way that GTK+ can unload your module if some instance 
of a type created in it is still around. That would just lead to a
segfault.

Regards,
                                         Owen

> >>Hi,
> >>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.
> >
> >Regards,
> >                                            Owen
> >
> >  
> >
> >>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
> >>>use.
> >>>
> >>>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]