Based on the recent fix for
CBL-2673 that adds liveQuerierStopped() to LiveQuerierDelegate for notifying when the LiveQuerier is completely stopped so that its consumer (C4Query) knows when it can break up the retained cycle b/w itself and the delegate object and cleanup the memory.
However there is a bug in LiveQuerier::_stop() that _delegate.liveQuerierStopped() might not be called if the _query object is not initialized in the _runQuery() yet when the _stop() is called. This issue has been found when running "Close Database with Active Live Query" test in CBL-C; the test was failed as the the c4Query and LiveQuerier object were leaked after the test was done.
After discussing with Jim Borden, the fix would be that
1. _delegate.liveQuerierStopped() will be called whether the _query is initialized or not.
2. Adding _stopping check to the stop() method to make sure that the stop operation will be called only once.