After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 135070 - Can only start one instance
Can only start one instance
Status: RESOLVED FIXED
Product: gnome-applets
Classification: Other
Component: keyboard indicator (gswitchit)
git master
Other Linux
: Normal normal
: 2.10
Assigned To: Sergey V. Udaltsov
gnome-applets Maintainers
Depends on: 127251
Blocks:
 
 
Reported: 2004-02-21 21:29 UTC by Dennis Smit
Modified: 2005-01-11 00:34 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10



Description Dennis Smit 2004-02-21 21:29:50 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.
Comment 1 Kevin Vandersloot 2004-02-21 23:30:43 UTC
This is almost always a problem with using global variables for
applets. Each instance of an applet will share any global variables
Comment 2 Dennis Smit 2004-02-22 01:47:06 UTC
Yep, i know, i'll look into it.
Comment 3 Sergey V. Udaltsov 2004-02-23 09:08:00 UTC
??? Why would applets share global variables? Does this mean
gnome-panel uses special type of loader which makes all data segments
shareable???
Comment 4 Dennis Smit 2004-02-23 11:13:26 UTC
An applet is only one response which starts instances.

We've discussed this on IRC so i won't clearify here any further ;)
Comment 5 Sergey V. Udaltsov 2004-02-23 11:33:01 UTC
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.
Comment 6 Sergey V. Udaltsov 2004-02-25 14:59:57 UTC
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?
Comment 7 Dennis Smit 2004-02-27 01:23:56 UTC
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.
Comment 8 Sergey V. Udaltsov 2004-02-27 09:07:00 UTC
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:)
Comment 9 Dennis Smit 2004-02-27 11:51:36 UTC
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.
Comment 10 Sergey V. Udaltsov 2004-02-27 14:56:45 UTC
Do you mean NULLifying the var (well, first making it global, not
local) - so next initialization could pass successfully? Is this what
you mean?
Comment 11 Dennis Smit 2004-02-27 14:59:04 UTC
I am not sure what the right solution would be, Kevin could you
provide an idea ?
Comment 12 Sergey V. Udaltsov 2004-02-27 15:11:40 UTC
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?
Comment 13 Dennis Smit 2004-02-27 15:18:29 UTC
That is right. 
Comment 14 Sergey V. Udaltsov 2004-02-27 15:23:15 UTC
I think I can do it. It should be easy. I will try tonight.
Comment 15 Kevin Vandersloot 2004-02-28 19:51:26 UTC
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.
Comment 16 Sergey V. Udaltsov 2004-02-28 22:22:03 UTC
"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.
Comment 17 Sergey V. Udaltsov 2004-02-29 22:37:25 UTC
At least the "3rd instance" scenario works now.
Comment 18 Danielle Madeley 2004-10-30 13:50:40 UTC
What is the status of this bug?
Comment 19 Sergey V. Udaltsov 2004-10-30 23:16:50 UTC
Same story. Second applet does not appear. Third applet is ok. I will try to
have a look at the second applet use case.
Comment 20 Danielle Madeley 2005-01-09 07:12:37 UTC
It would be nice to have this resolved for G10.
Comment 21 Sergey V. Udaltsov 2005-01-09 23:45:47 UTC
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...
Comment 22 Sergey V. Udaltsov 2005-01-11 00:34:40 UTC
Fixed in CVS. Though gswitchit-plugins are broken from this point...:(