[jitsi-dev] UI-Plugin system broken?


#1

Hey

I've just noticed something weird with the "Check for Updates" entry in the
Help menu:
- In the productive Jitsi it's no longer present all
- Launched from Eclipse (without debugger): The menu is there, but with the
Java Look&Feel (motif?)
- Launched from Eclipse (with debugger attached): Sometimes normal behavior.

The different behavior based on a debugger attached leads me to believe that
this is a timing issue. What I find a bit weird is how the plugins are
registered... The menu hosts a PluginContainer, but only creates an instance
of it. The constructor apparently searches for already registered plugins,
and then delegates the task to listen for new plugins to the UIService
(why?). The UIService keeps the references to the PluginListeners as
WeakReferences, so the PluginContainer is probably garbage-collected as the
JIT-compiler is probably intelligent enough to throw the unused reference in
the HelpMenu away (leaving the PluginContainer without root and thus
collectable).

Perhaps I'm also completely off-track and it's just something with all the
SwingUtilities.invokeLater stuff that changed about a week ago...

Regards,
Ingo


#2

Hi Ingo,

r10111 fixes the issues you have seen. Please, can you check again?

Thanks
damencho

···

On Wed, Nov 28, 2012 at 12:50 AM, Ingo Bauersachs <ingo@jitsi.org> wrote:

Hey

I've just noticed something weird with the "Check for Updates" entry in the
Help menu:
- In the productive Jitsi it's no longer present all
- Launched from Eclipse (without debugger): The menu is there, but with the
Java Look&Feel (motif?)
- Launched from Eclipse (with debugger attached): Sometimes normal behavior.

The different behavior based on a debugger attached leads me to believe that
this is a timing issue. What I find a bit weird is how the plugins are
registered... The menu hosts a PluginContainer, but only creates an instance
of it. The constructor apparently searches for already registered plugins,
and then delegates the task to listen for new plugins to the UIService
(why?). The UIService keeps the references to the PluginListeners as
WeakReferences, so the PluginContainer is probably garbage-collected as the
JIT-compiler is probably intelligent enough to throw the unused reference in
the HelpMenu away (leaving the PluginContainer without root and thus
collectable).

Perhaps I'm also completely off-track and it's just something with all the
SwingUtilities.invokeLater stuff that changed about a week ago...

Regards,
Ingo


#3

Hi Damian

The menu is still not there in the production version, however I cannot
reproduce it anymore with the debug-builds.

Looking at your patch, I don't really see how it could make a difference
from a code-flow point of view. It certainly changed some timings, so I
guess it's just luck that it works in the debug builds...

Regards,
Ingo

From: damencho@damencho.com [mailto:damencho@damencho.com] On Behalf Of
Damian Minkov
Sent: Mittwoch, 28. November 2012 09:38
To: dev@jitsi.java.net
Subject: [jitsi-dev] Re: UI-Plugin system broken?
Hi Ingo,

r10111 fixes the issues you have seen. Please, can you check again?

Thanks
damencho

Hey

I've just noticed something weird with the "Check for Updates" entry in
the Help menu: - In the productive Jitsi it's no longer present all -
Launched from Eclipse (without debugger): The menu is there, but with
the Java Look&Feel (motif?) - Launched from Eclipse (with debugger
attached): Sometimes normal behavior.

The different behavior based on a debugger attached leads me to believe
that this is a timing issue. What I find a bit weird is how the plugins
are registered... The menu hosts a PluginContainer, but only creates an
instance of it. The constructor apparently searches for already
registered plugins, and then delegates the task to listen for new
plugins to the UIService (why?). The UIService keeps the references to
the PluginListeners as WeakReferences, so the PluginContainer is
probably garbage-collected as the JIT-compiler is probably intelligent
enough to throw the unused reference in the HelpMenu away (leaving the
PluginContainer without root and thus collectable).

Perhaps I'm also completely off-track and it's just something with all

the

···

-----Original Message-----
On Wed, Nov 28, 2012 at 12:50 AM, Ingo Bauersachs <ingo@jitsi.org> wrote:

SwingUtilities.invokeLater stuff that changed about a week ago...

Regards,
Ingo