[Approved] Fix for PluginManager calling WndProc() twice (1 Viewer)

michael_t

Portal Pro
November 30, 2008
1,258
813
Home Country
Germany Germany
I found a bug in Core.guilib.PluginManager that results in plugin.WndProc() beeing called twice with the same message for all process plugins.
PluginManager.WndProc() first goes through all nonGuiPlugins and then through all SetupForm plugins to call each plugin's WndProc() function. Thus all process plugins with a setup form get called twice. I could imagine that this might cause some problems e.g. with PowerScheduler client plugin since all power events (suspend, resume etc.) are signalled twice.
My patch for PluginManager.cs modifies WndProc() to go only through all SetupForm plugins, so each plugin is handled exactly once. Since plugins are only accepted if they have a setup form, no plugin in the nonGuiPlugin list is missing.

Michael
 

Attachments

  • Fix for PluginManager calling WndProc() twice.patch
    30.8 KB

chemelli

Retired Team Member
  • Premium Supporter
  • September 28, 2006
    6,159
    2,264
    51
    Milano, Italy
    Home Country
    Italy Italy
    Patch doesn't take care of non gui plugins (aka process plugins).

    *Rejected*

    Simone
     

    michael_t

    Portal Pro
    November 30, 2008
    1,258
    813
    Home Country
    Germany Germany
    AW: Fix for PluginManager calling WndProc() twice

    Patch doesn't take care of non gui plugins (aka process plugins).
    I think that this is not correct, since in LoadPlugins() process plugins are only added to the _nonGuiPlugins list if they have a SetupForm (and are enabled in mediaportal.xml).
    Code:
      244                     if (PluginEntryExists(setup.PluginName()) && IsPluginNameEnabled(setup.PluginName()))
      245                     {
      246                       _setupForms.Add(setup);
      247                       _nonGuiPlugins.Add(plugin);
      248                     }
    So they are registered twice: in the _setupForms list and in the _nonGuiPlugins list. This results in the described bug that these plugins' WndProc() is called twice: first from the _nonGuiPlugins loop and then from the _setupForms loop. So leaving away the first loop is just the right way to prevent the double signalling of messages.

    Michael
     

    Users who are viewing this thread

    Top Bottom