I think I found the source of the problem!
When a display is created and it makes use of a control, e.g. ITime, the __script_get_control() method of scripting.Script is called to return an instance of the appropriate control. When this happens, ControlFactory.get_control() already calls the constructor for the control object. At this point the timeout function of ITime kicks in and is passed to gobject.timeout_add(). Then the control is appended to the __loaded_controls attribute of Script().
So far so good.
But now, the control gets deep-copied by the ControlWrapper and a second instance of the control is created that also passes its timeout function into gobject.timeout_add().
When the display is then removed the controls created by the wrapper persist. When I circumvent the ControlWrapper and return the control obtained by ControlFactory instead everything works as expected. The control gets shut down and all its timers removed.
Is there any information about the purpose and use of the ControlWrapper somewhere in the repo?
I think I found the source of the problem! get_control( ) method of scripting.Script is called to return an instance of the appropriate control. When this happens, ControlFactory. get_control( ) already calls the constructor for the control object. At this point the timeout function of ITime kicks in and is passed to gobject. timeout_ add(). Then the control is appended to the __loaded_controls attribute of Script(). timeout_ add().
When a display is created and it makes use of a control, e.g. ITime, the __script_
So far so good.
But now, the control gets deep-copied by the ControlWrapper and a second instance of the control is created that also passes its timeout function into gobject.
When the display is then removed the controls created by the wrapper persist. When I circumvent the ControlWrapper and return the control obtained by ControlFactory instead everything works as expected. The control gets shut down and all its timers removed.
Is there any information about the purpose and use of the ControlWrapper somewhere in the repo?