# Cannot terminate a session

**URL:** <https://devforum.zoom.us/t/cannot-terminate-a-session/67147>\
**Category:** Windows\
**Created:** [April 6, 2022, 6:52pm UTC](https://devforum.zoom.us/t/cannot-terminate-a-session/67147 "2022-04-06T18:52:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadu\_cemo](https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/32.png) [@kadu\_cemo](https://devforum.zoom.us/u/kadu_cemo)\
**Post date:** [April 6, 2022, 6:52pm UTC](https://devforum.zoom.us/t/cannot-terminate-a-session/67147/1 "2022-04-06T18:52:21Z")

</div>

Hi,

I´m having problems terminating the session.

When I use the method

```auto
GetSdkInstance()->leaveSession(false);

```

It works as it is supposed to…(Just leaving the session).

But when I set the leaveSession parameter to **true** … The session that is supposed to **terminate** , did not terminate and I do not leave the session… The onLeave delegate is never reached…

Just one more info: leaveSession returns ZoomVideoSDKErrors\_Success(0).

I am missing something… Could anyone help me?

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [April 7, 2022, 5:37pm UTC](https://devforum.zoom.us/t/cannot-terminate-a-session/67147/2 "2022-04-07T17:37:44Z")

</div>

Hi @kadu_cemo,

Can you please confirm whether the current user is the host of the session when you call this? Also, what is the return value of `leaveSession`?

Thanks!

---

<div class="post-metadata">

**Author:** ![kadu\_cemo](https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/32.png) [@kadu\_cemo](https://devforum.zoom.us/u/kadu_cemo)\
**Post date:** [April 7, 2022, 6:42pm UTC](https://devforum.zoom.us/t/cannot-terminate-a-session/67147/3 "2022-04-07T18:42:57Z")

</div>

**Hi Jon,**

The user who is terminating the session is the Host… So I´ve been coding lately and I found out that problem happens only when I create my session in a Thread different from main thread. So if I use the main thread from my app (the one that deals with my GUI) this problem disappears… 🤔

Does it make any sense?

Thank you in advance…

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [April 7, 2022, 10:16pm UTC](https://devforum.zoom.us/t/cannot-terminate-a-session/67147/4 "2022-04-07T22:16:36Z")

</div>

Hi @kadu_cemo,

All SDK methods should only be accessed on the main thread. I think our documentation had mentioned this, but it seems like it was accidentally removed. I’ll work with our documentation team on getting this info added back in.

Thanks!

---

<div class="post-metadata">

**Author:** ![kadu\_cemo](https://avatars.discourse-cdn.com/v4/letter/k/59ef9b/32.png) [@kadu\_cemo](https://devforum.zoom.us/u/kadu_cemo)\
**Post date:** [April 8, 2022, 11:41am UTC](https://devforum.zoom.us/t/cannot-terminate-a-session/67147/5 "2022-04-08T11:41:02Z")

</div>

Hi Jon,

Thanks for you reply… I´ll will do as you told me so.

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [April 8, 2022, 10:54pm UTC](https://devforum.zoom.us/t/cannot-terminate-a-session/67147/6 "2022-04-08T22:54:42Z")

</div>

You’re welcome! And if you run into any other issues please don’t hesitate to reach back out in a new topic. 🙂

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [April 8, 2022, 10:54pm UTC](https://devforum.zoom.us/t/cannot-terminate-a-session/67147/7 "2022-04-08T22:54:45Z")

</div>


