소스 검색

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 8 년 전
부모
커밋
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();