Which disposable to use for a component validator in a settings window?
Answered
I am validating my JBTextFields in my plugin settings component using the component validation described here.
However, it does not seem right to use the project as parent disposable when reading the disposer documentation here. But I am unsure which parent disposable to use in this case. The validators are only required as long as the settings window is open, but I am not sure which disposable corresponds to the settings window.
I am grateful for any suggestions.
Please sign in to leave a comment.
If you inherit from
com.intellij.openapi.options.SettingsEditor
, you can passthis
instead.Thanks, I changed it!
What is the proper parentDisposable for a SettingsEditor? Currently, I did not register it, and a memory leak is detected during the build.
Sorry for delay. What exactly is the problem/stacktrace?
VisualDebuggerSettingsConfigurable should implement Disposable, then pass its instance (`this`) to VisualDebuggerSettingsComponent.addInputFieldValidator() into CTOR of ComponentValidator.
But when is the VisualDebuggerSettingsConfigurable registered for disposal?
I still get a similar stack trace after the changes:
Any news?
Sorry for delay, will try to check ASAP again
Any news on this?
Any news?
Sorry I will check next week.
Alright thanks!
Please use this as a reference implementation (dedicated
Disposable
instance for validators managed by theConfigurable
instance): https://github.com/JetBrains/intellij-community/blob/master/plugins/kotlin/base/compiler-configuration-ui/src/org/jetbrains/kotlin/idea/base/compilerPreferences/configuration/KotlinCompilerConfigurableTab.java#L129Thanks for the answer. That seems to work for the memory leak in my plugin. The error during the build is gone. However, there is an error during runtime (runIde gradle task).
It seems that my code is causing a memory leak in the
KotlinCompilerConfigurableTab.
This only happens when I click on the action in my debugging tab but not when I open the settings normally (Stacktrace appears after closing the IDE run from the installed IDE). It is quite weird since I am using the same implementation, but there is no memory leak in my configurable. Maybe you have an idea? Otherwise, I will ignore it.Memory leak stack trace:
Sehr gut! It seems there are known problems with
KotlinCompilerConfigurableTab
https://youtrack.jetbrains.com/issues?q=KotlinCompilerConfigurableTab so please ignore it.