This was a regression following the move to the edition 2021.
The CallbackUserData was not capture in the lamda, its member were moved.
So the destructor was called right after it was set.
We must make sure we capture the whole CallbackUserData, so put the callback
inside of it. This also reduce a bit of code duplication at the same time.
Test the callback invokation with statefull lambda