Python API: Linking sink to incompatible object sets internal object state incorrectly
Summary
When using the Python API, connecting a sink to the wrong type of object (a window for example) results in an error message that says that the sink cannot be linked. Yet connecting it right after to a compatible object (a warp for example) results in a warning that the sink is already linked.
How to reproduce ?
- Open the REPL by running
splash -P addons/python/repl.py
- Run the following snippet
import splash
sink = splash.Sink()
sink.link_to("window_1")
# >>> 2023-07-01T19:39:23 / [WARNING] / GraphObject::linkTo - Unable to link objects of type sink and window
sink.link_to("window_1_cam1_warp")
# <console>:1: Warning: The sink is already linked to an object
sink.unlink()
sink.link_to("window_1_cam1_warp")
You should see the two messages in the comments appear in the terminal.
Expected behavior
When trying to link to an incompatible object, the internal state shouldn't be changed to linked. It should only be changed on a successful link. The user shouldn't need to unlink firt.
What is the frequency of occurrence of this behavior ?
This bug occurs every time you run the above snippet.