Fix accessing to non-existed instance issue on buffer/windows with time&count

* Move class data to state object
* Do not use pointer to this inside lambda
* Add test for time only triggered buffer/window