BlankSourceCode / obs-zoom-to-mouse

An OBS lua script to zoom a display-capture source to focus on the mouse
178 stars 15 forks source link

Switching Scene Collections Breaks #32

Open davidvkimball opened 4 months ago

davidvkimball commented 4 months ago

When I switch scene collections (on OBS 2.9.1.1 to remain compatible with StreamElements) I get a window that pops up saying:

"There was a problem while changing scene collections and some sources could not be unloaded. T his issue is typically cuased by plugins that are not releasing resources properly. Please ensure that any plugins you are using are up to date.

OBS Studio will now exit to prevent any potential data corruption."

It is directly related to this plugin. When I remove it, this issue goes away.

Any idea on a fix?

BlankSourceCode commented 4 months ago

@davidvkimball There is a weird issue with that version of OBS that I couldn't ever figure out. If you look at this line: https://github.com/BlankSourceCode/obs-zoom-to-mouse/blob/53dc1a5425c2a96db34fb34aae40283f84bf1720/obs-zoom-to-mouse.lua#L1409

You'll see a comment about it crashing when trying to release the sources.

If you are not on the latest script from main you could try downloading it directly (instead of the releases page which is slightly older).

If you are already on main, you could try removing that if check, so that the script does release the scene item stuff even on your version of OBS.

Give it a go and let me know.

davidvkimball commented 4 months ago

@BlankSourceCode hey James! Thank you for the reply and suggestion. Honestly, I am struggling with the syntax, I keep getting errors when importing into OBS.

Do you mind making those modifications for me and dropping me the file? Or telling me specifically how to remove the if check?

BlankSourceCode commented 4 months ago

@davidvkimball Does it still crash if you just use the version of the script from main (without modifications)?

davidvkimball commented 4 months ago

@BlankSourceCode yes, I forgot to mention, I had downloaded the main version the first time (I never used a release). Just tried again now for a sanity check, still crashes.

BlankSourceCode commented 4 months ago

@davidvkimball Ok. Try this which is just main with the version check removed: obs-zoom-to-mouse.zip

So it will release the scene item the same way it does in OBS v30+

If that still crashes, could you try looking at the crash/script log and reply with anything interesting from there.

davidvkimball commented 4 months ago

Crash 2024-02-18 21-16-38.txt

@BlankSourceCode thank you! Unfortunately I got a crash there also, with no warning this time. Happened upon Scene Collection switch.

BlankSourceCode commented 4 months ago

The log says its crashing when trying to unregister the hotkey. Try this script which just skips that part but still releases the scene item:

obs-zoom-to-mouse.zip

davidvkimball commented 4 months ago

@BlankSourceCode thank you so much! This one works - only quirk I could find is that switching scene collections makes the hotkey not work anymore until I restart OBS. But nothing crazy! Really appreciate your help.