From 4d6dd808b1bcb725eb8bd751ead455d81cbfc5ef Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sat, 21 Jun 2014 23:14:18 +0200 Subject: [PATCH] Make ErrorNetworkReply readable --- qutebrowser/network/schemehandler.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qutebrowser/network/schemehandler.py b/qutebrowser/network/schemehandler.py index 51309c218..6cf8af365 100644 --- a/qutebrowser/network/schemehandler.py +++ b/qutebrowser/network/schemehandler.py @@ -131,6 +131,9 @@ class ErrorNetworkReply(QNetworkReply): super().__init__(parent) self.setRequest(req) self.setUrl(req.url()) + # We don't actually want to read anything, but we still need to open + # the device to avoid getting a warning. + self.setOpenMode(QIODevice.ReadOnly) self.setError(error, errorstring) # For some reason, a segfault will be triggered if these lambdas aren't # there. @@ -144,3 +147,7 @@ class ErrorNetworkReply(QNetworkReply): def bytesAvailable(self): """We always have 0 bytes available.""" return 0 + + def readData(self): + """No data available.""" + return bytes()