You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
View.Unload() method is never called on the custom settings view created by overriding Module.GetSettingsView() when switching between the Module Settings tab and other tabs of the blish settings window. As a consequence when in View.Build() an event is subscribed to, it cannot be unsubscribed in View.Unload(). This leads to an additional event subscription each time the module settings tab is selected.
publicclassModuleSettingsView:View{publicModuleSettingsView(Serviceservice){_service=service;}protectedoverrideasyncvoidBuild(ContainerbuildPanel)// called each time the module settings tab is opened{
_service.MyEvent +=OnMyEvent;}protectedoverridevoidUnload()// never called{
_service.MyEvent -=OnMyEvent;}}
expected behavior
View.Unload() is called when
the module settings tab is left by switching to another tab of blish settings window
the blish settings window is closed
"Disable Module" is clicked
workaround until fixed
Module class
privateModuleSettingsView_moduleSettingsView;publicoverride IView GetSettingsView(){_moduleSettingsView ??= new ModuleSettingsView(_service);return_moduleSettingsView;}
ModuleSettingsView class
publicclassModuleSettingsView:View{publicModuleSettingsView(Serviceservice){_service=service;}protectedoverrideasyncvoidBuild(ContainerbuildPanel)// called each time the module settings tab is opened{
_service.MyEvent -=OnMyEvent;
_service.MyEvent +=OnMyEvent;}}
occurs in Blish 1.1.1
observed behavior
View.Unload() method is never called on the custom settings view created by overriding Module.GetSettingsView() when switching between the Module Settings tab and other tabs of the blish settings window. As a consequence when in View.Build() an event is subscribed to, it cannot be unsubscribed in View.Unload(). This leads to an additional event subscription each time the module settings tab is selected.
Example:
Module class
ModuleSettingsView class
expected behavior
View.Unload() is called when
workaround until fixed
Module class
ModuleSettingsView class
relevant discord discussion:
https://discord.com/channels/531175899588984842/599270434642460753/1227691731231838360
The text was updated successfully, but these errors were encountered: