Browse Source

Don't load/unload plugins in the EDT

Fixes CLIENT-226

Change-Id: I23a058df642f2738e2878491e72b679d04554257
Reviewed-on: http://gerrit.dmdirc.com/1916
Reviewed-by: Chris Smith <chris@dmdirc.com>
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
tags/0.7rc1
Greg Holmes 13 years ago
parent
commit
3a479cb30f
1 changed files with 22 additions and 15 deletions
  1. 22
    15
      src/com/dmdirc/addons/ui_swing/components/addonpanel/AddonToggle.java

+ 22
- 15
src/com/dmdirc/addons/ui_swing/components/addonpanel/AddonToggle.java View File

@@ -100,22 +100,29 @@ public class AddonToggle {
100 100
      * Applies the changes to the PluginInfo, if any.
101 101
      */
102 102
     public void apply() {
103
-        if (pi != null && toggled) {
104
-            if (pi.isLoaded()) {
105
-                pi.unloadPlugin();
106
-            } else {
107
-                pi.loadPlugin();
103
+        new Thread("Addon-Load-Unload") {
104
+
105
+            /** {@inheritDoc} */
106
+            @Override
107
+            public void run() {
108
+                if (pi != null && toggled) {
109
+                    if (pi.isLoaded()) {
110
+                        pi.unloadPlugin();
111
+                    } else {
112
+                        pi.loadPlugin();
113
+                    }
114
+                    PluginManager.getPluginManager().updateAutoLoad(pi);
115
+                }
116
+                if (theme != null && toggled) {
117
+                    if (theme.isEnabled()) {
118
+                        theme.applyTheme();
119
+                    } else {
120
+                        theme.removeTheme();
121
+                    }
122
+                    ThemeManager.updateAutoLoad(theme);
123
+                }
108 124
             }
109
-            PluginManager.getPluginManager().updateAutoLoad(pi);
110
-        }
111
-        if (theme != null && toggled) {
112
-            if (theme.isEnabled()) {
113
-                theme.applyTheme();
114
-            } else {
115
-                theme.removeTheme();
116
-            }
117
-            ThemeManager.updateAutoLoad(theme);
118
-        }
125
+        }.start();
119 126
     }
120 127
 
121 128
     /**

Loading…
Cancel
Save