How do I properly handling disconnecting signals in kwin?

Right now I’m testing my script in the plasma interactive console. If I am connected to signals. they continue to persist. What is the proper way to handle disconnecting them?

  1. If I have an installed script will it automatically disconnect them if the script is disabled?

  2. If I have some code like this
    workspace.windowRemoved.connect((window) => geometryChange(window.internalId))

Will calling this code disconnect it? Or are these functions stored at different memory addresses so it’s not the proper way?

workspace.windowRemoved.disconnect((window) => geometryChange(window.internalId))