object: use weakref when advancing current transition
Fixes reference count leak when activating an object and transition fails. The leak can be seen with valgrind when running the session item activate-error
unit test:
valgrind --suppressions=/usr/share/glib-2.0/valgrind/glib.supp --leak-check=full ./build/tests/wp/test-session-item -p activation-error
When wp_transition_return_error()
is called, the transition is never removed from the object's transitions queue. When that happens, the object will never be destroyed because the transition also holds a strong reference of the object.
To solve this leak, the transitions are now stored in a weak reference before advancing them, and they will be removed from the transition queue once the weak reference is null or the transition has been completed.