Explorar o código

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 %!s(int64=8) %!d(string=hai) anos
pai
achega
7e68abba5c
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  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();