Revision
16432
Author
jmesquita
Date
2010-01-20 23:44:42 -0600 (Wed, 20 Jan 2010)

Log Message

Fix segv when switching from a call that was previously hungup.

Modified Paths

Diff

Modified: freeswitch/trunk/fscomm/call.h (16431 => 16432)


--- freeswitch/trunk/fscomm/call.h	2010-01-21 05:05:56 UTC (rev 16431)
+++ freeswitch/trunk/fscomm/call.h	2010-01-21 05:44:42 UTC (rev 16432)
@@ -49,6 +49,7 @@
 public:
     Call();
     Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid);
+    /*~Call() { qDebug() << "I am being freed uuid: " << _uuid; }*/
     QString getCidName(void) { return _cid_name; }
     QString getCidNumber(void) { return _cid_number; }
     int getCallID(void) { return _call_id; }

Modified: freeswitch/trunk/fscomm/fshost.cpp (16431 => 16432)


--- freeswitch/trunk/fscomm/fshost.cpp	2010-01-21 05:05:56 UTC (rev 16431)
+++ freeswitch/trunk/fscomm/fshost.cpp	2010-01-21 05:44:42 UTC (rev 16432)
@@ -162,6 +162,15 @@
 {
     switch_status_t status = SWITCH_STATUS_SUCCESS;
     QSharedPointer<Call> call = _active_calls.value(uuid);
+
+    if (call.isNull())
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "We don't have a call object for A leg on event %s.\n", switch_event_name(event->event_id));
+        qDebug() << _active_calls.keys();
+        printEventHeaders(event);
+        return SWITCH_STATUS_FALSE;
+    }
+
     /* Inbound call */
     if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
     {
@@ -226,6 +235,15 @@
     QString uuid = _bleg_uuids.value(buuid);
     switch_status_t status = SWITCH_STATUS_SUCCESS;
     QSharedPointer<Call> call = _active_calls.value(uuid);
+
+    if (call.isNull())
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "We don't have a call object for B leg on event %s.\n", switch_event_name(event->event_id));
+        qDebug() << _active_calls.keys();
+        printEventHeaders(event);
+        return SWITCH_STATUS_FALSE;
+    }
+
     /* Inbound call */
     if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
     {

Modified: freeswitch/trunk/fscomm/mainwindow.cpp (16431 => 16432)


--- freeswitch/trunk/fscomm/mainwindow.cpp	2010-01-21 05:05:56 UTC (rev 16431)
+++ freeswitch/trunk/fscomm/mainwindow.cpp	2010-01-21 05:44:42 UTC (rev 16432)
@@ -211,7 +211,9 @@
         return;
     }
     ui->hangupBtn->setEnabled(true);
-    lastCall.data()->setActive(false);
+    /* Last call was hungup and we are switching */
+    if (!lastCall.isNull())
+        lastCall.data()->setActive(false);
     call.data()->setActive(true);
 }