GNOME Bugzilla – Bug 135070
Can only start one instance
Last modified: 2005-01-11 00:34:40 UTC
It seems that i can't start more than one instance of the applet the others won't show up in the panel however, when i remove the applet that is shown, the process keeps running. And when i kill that process the panel will ask if i should reload the other instances. So they are registered but now shown.
This is almost always a problem with using global variables for applets. Each instance of an applet will share any global variables
Yep, i know, i'll look into it.
??? Why would applets share global variables? Does this mean gnome-panel uses special type of loader which makes all data segments shareable???
An applet is only one response which starts instances. We've discussed this on IRC so i won't clearify here any further ;)
This whole thing is a big mess. Currently, the applet is SPECIALLY AND INTENTIONALLY PROTECTED from the second initalization (and all related problems). Because even if you add one applet, the initialization function is called twice (yes it does - and there is a bug about it). So in order to avoid the problems with the second initialization, I added the guard. Now, could anyone please explain me how would the applet distinguish second erroneous initialization of one instance - from the initialization of the second instance? This all looks same - the repeated calls of GSwitchItAppletInit.
OK. After the initialization bug is considered closed, I am thinking about this nasty one. So, suppose I remove the double-init check (because now double init just means second applet). Then... First, there is a question about the applet properties - should each applet has its own preferences or can there be single set of them. Currently there a single place in the gconf where gswitchit stores its config - so no per-instance config is possible. Then, libxklavier init/term should be managed on the instance counter basis - first instance calls init, last instance calls term. Then, libxklavier is does not allow multiple callbacks for the same type of event (the API is like "set listener" not "add listener") - so actually gswitchit should have internal list of existing applets and callbacks should work with the list (I cannot have callback per event per applet). Also, the "first registers, last unregisters" logic applies here. Basically, this should be it. Once again, I ask - do you want all these major changes in 2.6? Should I branch?
Alright this is quite major. Maybe it's best to just make sure that only one instance gets loaded and popup a warning to notify the user that only one gswitchit applet can be run at a time. I think this would do for 2.6 and fix it up for real for 2.8 or something in that course.
Popup a warning, you say? пл. Only after you settle the string breakage with GTP folks. I am sick of fighting with them around g-c-c:)
Yeah, true. Well currently new instances are registred so when you quit the one that was active you can't add it again because of the process still running (if someone added more than one instancea). Maybe it's fair if only this is fixed.
Do you mean NULLifying the var (well, first making it global, not local) - so next initialization could pass successfully? Is this what you mean?
I am not sure what the right solution would be, Kevin could you provide an idea ?
Do I understand your use case right: 1. User adds instance #1 2. User adds instance #2 (does not show because of this bug) 3. User removes instance #1 (the process does not terminate because of #2) 4. User adds instance #3 - and you want it to appear. Do I get your request right?
That is right.
I think I can do it. It should be easy. I will try tonight.
Sergey: I wouldn't worry too much about this bug for 2.6. I would rather avoid any big possibly destabalizing changes at this point. I think the number of people trying to add two gswtichits would be small, and we can worry about that later. I think for 2.6 we can just silently quit if an instance already is running.
"Silently quit" is a good word. But the problem is that in this case the process is hanging even after the first instance is gone. So I'd like to allow at least 3rd instance to start propertly - and hopefully it won't be a great breakage.
At least the "3rd instance" scenario works now.
What is the status of this bug?
Same story. Second applet does not appear. Third applet is ok. I will try to have a look at the second applet use case.
It would be nice to have this resolved for G10.
ghm... I'm afraid no chance. I will try - but not promises, really... I kept this one on such a low priority that did not consider it during the last restructuring... Anyway, I'll see what I can do...
Fixed in CVS. Though gswitchit-plugins are broken from this point...:(