Studio Plugin Unloading Changes

#22

In accordance with this update, I’m thinking it’d be useful to have a way to manually trigger reloading all plugins. Perhaps a “Reload Plugins” Studio action. This could be a quick fix for misbehaving plugins without needing to restart Studio after the update goes live to kill plugin scripts after they’re unloaded. It’d also come in handy when you modify your plugins in one Studio window, and want to update your plugins in a second one.

14 Likes

#23

Yes, connections are automatically disconnected when scripts are stopped.

Yes, this fires both when a place is closed and when Studio itself is closed.

5 Likes

#24

How much time do we have to clean up then? It says immediately after the event, but if that were the case we wouldn’t be able to clean up at all would we? Or even receive the event? If we have particularly long/slow cleanups, will they be unexpectedly aborted even without yielding?

Just to confirm, this would run before the place is saved right? Otherwise any artififacts that are cleaned up would be saved in anyway? What about publishing?

And if so, Is there potential for a malicious plugin to, say, delete everything in workspace on unload, silently wrecking a developers local copy when they close studio, going unnoticed until they next work on that particular place, which could be awhile?

0 Likes

#25

The amount of time does not matter as long as your code does not yield.

This will not fire when saving a place. If you want to make sure instances in the DataModel are not preserved on save or publish, you should set the Archivable property to false.

0 Likes

#26

Got it, thanks

Always forget about Archivable, thanks.

Whats the point of firing on studio/place close, then? Anything it might want to clean up will either be unarchivable, or saved in the place anyway? Will this slow down studio/place closing? Could a malicious plugin enter an infinite loop to freeze studio on unload? Would such a plugin have to be manually uninstalled?

edit: to clarify, when i said “before the place is saved right?” i meant “before the place is saved, when closing the place”

0 Likes

#27

Personally, Archivable didn’t come to my mind until I saw your post above. Unloading did, however, and I implemented it a day ago in my plugin. There’s an indirect solution (set Archivable = false) and a direct solution (remove it on Unloading). I, personally, wouldn’t have thought of the indirect solution on my own. Many others won’t either.

Additionally, plugins unload on place close. The Unloading event fires when a plugin unloads and that’s great.

2 Likes