Hi,
I'm experiencing a consistent crash with Advanced Scene Switcher (latest version) on OBS 32.1.0 (64-bit) under Windows 10.
**Crash happens exactly when:**
- Switching to a different Scene Collection
- Closing OBS
The plugin works perfectly during normal use. The crash only occurs during the stop/unload phase.
**Crash details:**
- Exception: `c0000005` (access violation)
- Fault address: `w32-pthreads.dll!pthread_mutex_unlock+0x27`
- Stack trace always points to:
```
advanced-scene-switcher-lib.dll!advss::SendWebsocketVendorEvent
→ advss::RunStopSteps
→ advss::SwitcherData::Stop
→ advss::SwitcherData::~SwitcherData
→ FreeSceneSwitcher
→ obs.dll!free_module + obs_shutdown
```
It looks like the plugin is trying to send a WebSocket vendor event while its internal `SwitcherData` object is being destroyed, causing the mutex to be unlocked in an invalid state.
I can reproduce it 100% of the time just by switching scene collections.
Would it be possible to add a safeguard (or make the WebSocket event on stop optional) so the plugin doesn't crash during collection switch / shutdown?
Thanks in advance!
I assume the full crash log looks something like this:
Code:
0000005AD56FB160 00007FFF62145277 0000025429323D80 0000025429323D80 0000005AD56FB240 00007FFEEC70C5E0 w32-pthreads.dll!pthread_mutex_unlock+0x27
0000005AD56FB1A0 00007FFF2A8A7DC0 00000253926B0AD0 0000000000000000 0000025429340C00 00007FFEEC6709CF obs.dll!proc_handler_call+0x80
0000005AD56FB220 00007FFEEC65825C 00000253DC275060 00000253DC274FE0 0000025429340C00 00007FFEEC39E576 advanced-scene-switcher-lib.dll!advss::SendWebsocketVendorEvent+0xdc
0000005AD56FB270 00007FFEEC657DBA 0000000000000001 000002538FE4C000 0000000000000000 00007FFEEC89E0D0 advanced-scene-switcher-lib.dll!std::_Func_impl_no_alloc<`advss::setup'::`2'::<lambda_2>,void>::_Do_call+0x7a
0000005AD56FB2E0 00007FFEEC639D3F 00007FFEEC89E0D0 000002538FE4C000 0000000000000288 00000254278026C0 advanced-scene-switcher-lib.dll!advss::RunStopSteps+0x5f
0000005AD56FB320 00007FFEEC36E88C 00007FFEEC89E0D0 0000025421C55540 00000253BD625DE0 00007FFF2FFB285B advanced-scene-switcher-lib.dll!advss::SwitcherData::Stop+0xbc
0000005AD56FB3A0 00007FFEEC36A32B 0000025421C55540 0000000000000000 0000000000000288 00000253BD625DE0 advanced-scene-switcher-lib.dll!advss::SwitcherData::~SwitcherData+0x2b
0000005AD56FB3F0 00007FFEEC38A264 0000025427991040 000002542772EB00 00000253B9914C40 00000253B9812C88 advanced-scene-switcher-lib.dll!FreeSceneSwitcher+0x24
0000005AD56FB420 00007FFF2A83DBCE 0000000000000288 00000253BD625DE0 0000005AD56FB650 0000000000000288 obs.dll!free_module+0x3e
0000005AD56FB450 00007FFF2A8845C0 0000000000000000 0000005AD56FF4F0 0000005AD56FB599 0000025429459510 obs.dll!obs_shutdown+0x370
While the call stack does contain advss functions that particular type of crash is not caused by the advss plugin necessarily.
As you already pointed out the advss is just trying to emit a websocket event when changing scene collections.
The crash happens within the proc_handler_call call of the obs_websocket_vendor_emit_event function of the OBS websocket API.
The mutex in question is an OBS internal one and not used by the advss directly.
This can happen when there are source leaks anywhere in OBS (most likely a plugin).
I previously spent quite a bit of time trying to track down a potential issue within advss somehow corrupting OBS, but it ultimately turned out that a different plugin was just leaking resources.
Once I fixed the leak in the other plugin the issue was gone immediately.
I
assume even if you completely disable the advanced scene switcher via plugin manager you will instead run into an the "Source Cleanup Error" being reported:
If that is the case I would suggest disabling all plugins and turning them back on one by one to narrow down which one is the culprit.
But just in case can you please share the full crash log?
Then I will have another look.