mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-10 10:20:44 -07:00
Avoid crashing when enabling/disable/installing/deleting
This commit is contained in:
parent
07e5fb08b3
commit
50e03baea7
1 changed files with 15 additions and 6 deletions
|
|
@ -58,6 +58,9 @@ object ReflectiveEditorView : View {
|
|||
// Store reference to the search field
|
||||
private var searchField: CustomSearchField? = null
|
||||
|
||||
// Flag for scheduled plugin reload to avoid crashes
|
||||
private var reloadPlugins = false
|
||||
|
||||
private fun loadCogIcon() {
|
||||
try {
|
||||
val imageStream = this::class.java.getResourceAsStream("res/cog.png")
|
||||
|
|
@ -579,8 +582,8 @@ object ReflectiveEditorView : View {
|
|||
if (sourceDir.renameTo(destDir)) {
|
||||
showToast(mainPanel, "Plugin enabled")
|
||||
|
||||
// Reload plugins to apply the change
|
||||
PluginRepository.reloadPlugins()
|
||||
// Schedule plugin reload to avoid crashes
|
||||
reloadPlugins = true
|
||||
|
||||
// Refresh the plugin list view
|
||||
SwingUtilities.invokeLater {
|
||||
|
|
@ -661,8 +664,8 @@ object ReflectiveEditorView : View {
|
|||
if (sourceDir.renameTo(destDir)) {
|
||||
showToast(mainPanel, if (activated) "Plugin enabled" else "Plugin disabled")
|
||||
|
||||
// Reload plugins to apply the change
|
||||
PluginRepository.reloadPlugins()
|
||||
// Schedule plugin reload to avoid crashes
|
||||
reloadPlugins = true
|
||||
|
||||
// Refresh the plugin list view
|
||||
SwingUtilities.invokeLater {
|
||||
|
|
@ -789,6 +792,12 @@ object ReflectiveEditorView : View {
|
|||
return
|
||||
}
|
||||
|
||||
// Check if we need to reload plugins
|
||||
if (reloadPlugins) {
|
||||
PluginRepository.reloadPlugins()
|
||||
reloadPlugins = false
|
||||
}
|
||||
|
||||
// Update plugin statuses to reflect current loaded plugins
|
||||
updatePluginStatuses()
|
||||
|
||||
|
|
@ -1279,9 +1288,9 @@ object ReflectiveEditorView : View {
|
|||
if (deleteRecursively(pluginDir)) {
|
||||
showToast(mainPanel, "Plugin deleted successfully", JOptionPane.INFORMATION_MESSAGE)
|
||||
|
||||
// If we deleted a loaded plugin, reload plugins
|
||||
// If we deleted a loaded plugin, schedule plugin reload
|
||||
if (!isDisabled) {
|
||||
PluginRepository.reloadPlugins()
|
||||
reloadPlugins = true
|
||||
}
|
||||
|
||||
// Refresh the plugin list view
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue