Browse Source

Don't crash in UpdaterComponent

Fixes https://app.getsentry.com/plex/plex-media-player/group/93883058/
Tobias Hieta 9 năm trước cách đây
mục cha
commit
e5fa80466c
2 tập tin đã thay đổi với 10 bổ sung2 xóa
  1. 2 2
      src/system/UpdaterComponent.cpp
  2. 8 0
      src/system/UpdaterComponent.h

+ 2 - 2
src/system/UpdaterComponent.cpp

@@ -63,9 +63,9 @@ void UpdaterComponent::dlComplete(QNetworkReply* reply)
     emit downloadError(reply->errorString());
 
     if (m_hasManifest)
-      m_manifest->m_reply->abort();
+      m_manifest->abort();
 
-    m_file->m_reply->abort();
+    m_file->abort();
   }
 }
 

+ 8 - 0
src/system/UpdaterComponent.h

@@ -36,6 +36,7 @@ public:
     {
       disconnect(m_reply, 0, 0, 0);
       m_reply->deleteLater();
+      m_reply = NULL;
       m_openFile->close();
     }
 
@@ -109,6 +110,13 @@ public:
     return "";
   }
 
+  /////////////////////////////////////////////////////////////////////////////////////////
+  void abort()
+  {
+    if (m_reply)
+      m_reply->abort();
+  }
+
   ///////////////////////////////////////////////////////////////////////////////////////////////////
   QString m_url;
   QString m_localPath;