mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Proper fix for random crashes
This commit is contained in:
parent
46c646e49d
commit
e4e313f1d6
@ -127,6 +127,8 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler):
|
||||
def send_reply(self, rq, mime_type, data):
|
||||
if sip.isdeleted(rq):
|
||||
return
|
||||
# make the buf a child of rq so that it is automatically deleted when
|
||||
# rq is deleted
|
||||
buf = QBuffer(parent=rq)
|
||||
buf.open(QBuffer.WriteOnly)
|
||||
# we have to copy data into buf as it will be garbage
|
||||
@ -134,9 +136,7 @@ class UrlSchemeHandler(QWebEngineUrlSchemeHandler):
|
||||
buf.write(data)
|
||||
buf.seek(0)
|
||||
buf.close()
|
||||
buf.aboutToClose.connect(buf.deleteLater)
|
||||
rq.reply(mime_type.encode('ascii'), buf)
|
||||
|
||||
# }}}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user