FIX(plugins): Unset active positional plugin on unloading it #6602
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a plugin is providing positional audio data and it becomes unloaded, such as by disabling the plugin in the settings GUI, the plugin manager may still interact with the plugin through m_activePositionalDataPlugin.
This looks unintentional and, in debug mode, this fails an assertion in the plugin fairly quickly:
assertPluginLoaded(this)
.Also, the plugin manager shutdown is moved earlier, since quitting mumble and shutting down the plugin manager while a plugin is linked causes it the plugin manager to log a message through the global Log instance and for the Log instance to display a message on the main window. So bot the Log and the main window must still exist.
Checks
I haven't checked what this does in a release build or on any stable branches. I only noticed this assertion tripped on master if a plugin is un-enabled while it is linked.
And I'm not quite sure if moving where the plugin manager is deconstructed is quite right or if you have a different idea in mind. But if the log is destroyed before the plugin manager, it will try to log about the link lost when unloading an active plugin and crash. If the main window isn't around while logging it can crash trying to display the log in the main window.