Omit calling buttonAnswer when pointers are already reset 26/211826/1
authorTomasz Swierczek <t.swierczek@samsung.com>
Tue, 6 Aug 2019 06:33:38 +0000 (08:33 +0200)
committerTomasz Swierczek <t.swierczek@samsung.com>
Fri, 9 Aug 2019 09:03:59 +0000 (11:03 +0200)
Despite deleting entire popup with evas_object_del (which, I presume,
should also remove buttons with associated callbacks),
It looks like askuser is receiving delayed button-press events
from efl at the time when UI is already shut down, causing
segmentation fault on nonexistent object.

Change-Id: Id88f038eb3131912a3ee965b41608d09bed0d054

src/notification-daemon/ui/Popupper.cpp

index 26c97ff..f5ee5f0 100644 (file)
@@ -93,24 +93,28 @@ void Popupper::popupClose()
 }
 
 void Popupper::buttonAnswer(IAnswerable::Button button) {
-    NResponseType answer = m_answerablePtr->getAnswer(button);
-    m_responses.push_back(answer);
+    if (m_answerablePtr) {
+        NResponseType answer = m_answerablePtr->getAnswer(button);
+        m_responses.push_back(answer);
 
-    if (m_responses.size() == m_privaciesSequence.size()) {
-        m_popupResponseHandler(m_responses);
-        return;
-    }
+        if (m_responses.size() == m_privaciesSequence.size()) {
+            m_popupResponseHandler(m_responses);
+            return;
+        }
 
-    Privacy privacy;
-    if (!m_privaciesSequence.getNextPrivacy(privacy)) {
-        ALOGE("Unable to get next privacy");
-        respondToRest(NResponseType::None);
-        return;
-    }
+        Privacy privacy;
+        if (!m_privaciesSequence.getNextPrivacy(privacy)) {
+            ALOGE("Unable to get next privacy");
+            respondToRest(NResponseType::None);
+            return;
+        }
 
-    if (!m_elementPtr->showNext(Po::createPopupCheckMsg(m_pkgId, privacy))) {
-        ALOGE("unable to show next popup");
-        respondToRest(NResponseType::None);
+        if (!m_elementPtr->showNext(Po::createPopupCheckMsg(m_pkgId, privacy))) {
+            ALOGE("unable to show next popup");
+            respondToRest(NResponseType::None);
+        }
+    } else {
+        ALOGD("Popupper::buttonAnswer called without m_answerablePtr, skipping");
     }
 }