Skip to content

Commit bd23aff

Browse files
committed
Fix crash on stop
1 parent 1b87af5 commit bd23aff

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/countly.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,6 @@ void Countly::startOnCloud(const std::string& app_key) {
225225

226226
void Countly::stop() {
227227
mutex.lock();
228-
if (began_session) {
229-
mutex.unlock();
230-
endSession();
231-
mutex.lock();
232-
}
233228
stop_thread = true;
234229
mutex.unlock();
235230
if (thread != nullptr && thread->joinable()) {
@@ -240,6 +235,9 @@ void Countly::stop() {
240235
}
241236
delete thread;
242237
}
238+
if (began_session) {
239+
endSession();
240+
}
243241
}
244242

245243
void Countly::setUpdateInterval(size_t milliseconds) {

0 commit comments

Comments
 (0)