Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX(plugins): Unset active positional plugin on unloading it #6602

Merged
merged 1 commit into from
Jan 11, 2025

Conversation

sqwishy
Copy link
Contributor

@sqwishy sqwishy commented Oct 6, 2024

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).

Additionally, in case Mumble shuts down while there exists an active
positional data plugin, Mumble will (now) try to log that the plugin has
lost link by calling the respective function on the global Log instance.
However, at the point where the plugin manager object is destroyed, the
log has already been deleted, making this produce a segmentation fault.
To prevent this from happening, an explicit check for whether the Log
instance still exists has been added to the logging logic.

Fixes #6549

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.

@sqwishy
Copy link
Contributor Author

sqwishy commented Oct 8, 2024

I happened to notice that #6549 sounds related, and this might fix that issue.

Copy link
Member

@Hartmnt Hartmnt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit looks reasonable to me and I agree that this probably fixes #6549

It compiles and runs just fine, but I am unable to test if this fixes #6549 for real.

@Krzmbrzl thoughts?

src/mumble/PluginManager.cpp Outdated Show resolved Hide resolved
@Krzmbrzl
Copy link
Member

I have to double check that this doesn't cause unintended side effects in the semantics for plugins. 👀

@Krzmbrzl Krzmbrzl force-pushed the unload-pa-plugin branch 2 times, most recently from 3213792 to 14d323b Compare January 11, 2025 17:33
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)`.

Additionally, in case Mumble shuts down while there exists an active
positional data plugin, Mumble will (now) try to log that the plugin has
lost link by calling the respective function on the global Log instance.
However, at the point where the plugin manager object is destroyed, the
log has already been deleted, making this produce a segmentation fault.
To prevent this from happening, an explicit check for whether the Log
instance still exists has been added to the logging logic.

Fixes mumble-voip#6549
Copy link
Member

@Krzmbrzl Krzmbrzl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have replaced the earlier deletion of the plugin manager object with an explicit check for the existence of the Log instance.
This way, we don't change any semantics on when plugins are unloaded when Mumble shuts down. This is a rather complicated topic as there are many implicit relationships (mainly due to plugins having the opportunity to use an API to make calls into the Mumble code base and some of that code expects certain things to be around (or to be in a given state if they are no longer around)....
I don't feel like digging all that up if the fix can be seemingly as simple as adding a condition to an already existing if clause :)

@Krzmbrzl Krzmbrzl merged commit 7699d71 into mumble-voip:master Jan 11, 2025
15 checks passed
@Krzmbrzl
Copy link
Member

Thanks for fixing this 👍

@Krzmbrzl
Copy link
Member

💚 All backports created successfully

Status Branch Result
1.5.x

Questions ?

Please refer to the Backport tool documentation and see the Github Action logs for details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on disabling Link plugin while plugin is actively linked to a game.
3 participants