Преглед на файлове

RemoteSubscriber: fix crash if connection goes away

Reproduction steps:
- open web UI
- cast a video to PMP
- close the web UI while video is still playing

m_response then will point to a dnagling pointer, and crash PMP soon
enough. This is because QHttp uses deleteLater() on the object on
disconnects.

Fix this by using QPointer, which was designed for this purpose. If the
QObject is deleted, the QPointer will be reset to NULL.
Vincent Lang преди 9 години
родител
ревизия
7e68abba5c
променени са 1 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 2 1
      src/remote/RemoteSubscriber.h

+ 2 - 1
src/remote/RemoteSubscriber.h

@@ -6,6 +6,7 @@
 #define KONVERGO_REMOTESUBSCRIBER_H
 
 #include <QObject>
+#include <QPointer>
 #include <QUrl>
 #include <QDateTime>
 #include <QDomDocument>
@@ -78,7 +79,7 @@ public:
   void sendUpdate() override;
 
 private :
-   qhttp::server::QHttpResponse* m_response;
+   QPointer<qhttp::server::QHttpResponse> m_response;
 
 public Q_SLOTS:
    void responseDone();