Closed Meta-Maxim closed 1 year ago
i actually almost added this for 1.15
what i was thinking of doing is instead of this, making it a toggle option like i originally intended
If you mean the component janitor can mark that instances may be destroyed for other reasons/errorOnCleaningDestroyed then that sounds better, the double-destruction error could be a useful for other designs
@howmanysmall Added a toggle .SuppressInstanceReDestroy = false -- default
You're gonna need to pull from the latest if you want this merged.
✅
Okay, sorry about the delay. Pull again and I'll finally merge.
There you go.
May be another solution here, but my janitors run into errors when used in the following configuration:
guiJanitor
guiJanitor:Cleanup()
, destroying the gui and the descendant component instance. This triggers the component class's LinkToInstance cleanup after the descendant component instance was already destroyed, resulting in an error.As it's impossible to check if an instance has been destroyed already as opposed to just parented to nil, this change adds a pcall for only instance:Destroy() calls during cleanup.
Simple case: