summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2014-08-12 12:12:49 +0000
committerNanang Izzuddin <nanang@teluu.com>2014-08-12 12:12:49 +0000
commit9b2b83d6deb66c9f2b600a932f2dc4dc2ec71f0f (patch)
treea454d30def954322dd511d0be8f21310440c8f81
parentab136ddcf1c2cc5c7599cd815441794f37bdaee1 (diff)
Misc (re #1751): Remove reference to PJSUA2 Call instance from PJSUA library in PJSUA2 Call destructor regardless the PJSUA state to avoid crash caused by accessing dangling pointer of the Call instance (thanks Thomas Steinacher for the report).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4885 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsua2/call.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/pjsip/src/pjsua2/call.cpp b/pjsip/src/pjsua2/call.cpp
index b196d5d4..1e4e72f3 100644
--- a/pjsip/src/pjsua2/call.cpp
+++ b/pjsip/src/pjsua2/call.cpp
@@ -379,16 +379,17 @@ Call::Call(Account& account, int call_id)
Call::~Call()
{
- /**
+ /* Remove reference to this instance from PJSUA library */
+ if (id != PJSUA_INVALID_ID)
+ pjsua_call_set_user_data(id, NULL);
+
+ /*
* If this instance is deleted, also hangup the corresponding call in
* PJSUA library.
*/
- if (id != PJSUA_INVALID_ID && pjsua_get_state() < PJSUA_STATE_CLOSING) {
- pjsua_call_set_user_data(id, NULL);
- if (isActive()) {
- CallOpParam prm;
- hangup(prm);
- }
+ if (pjsua_get_state() < PJSUA_STATE_CLOSING && isActive()) {
+ CallOpParam prm;
+ hangup(prm);
}
}