Also copy QByteArray of clipboard data.

This could possibly fix segfaults some people have seen when pasting after
68a0428a09.

See #491.
This commit is contained in:
Florian Bruhin 2015-01-30 06:42:55 +01:00
parent b721a0e992
commit 4138debd1e

View File

@ -23,7 +23,8 @@ import sys
import itertools import itertools
import functools import functools
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QTimer, QUrl, QMimeData from PyQt5.QtCore import (pyqtSignal, pyqtSlot, Qt, QTimer, QUrl, QMimeData,
QByteArray)
from PyQt5.QtWidgets import QApplication, QStyleFactory from PyQt5.QtWidgets import QApplication, QStyleFactory
from PyQt5.QtGui import QClipboard from PyQt5.QtGui import QClipboard
from PyQt5.QtWebKit import QWebSettings from PyQt5.QtWebKit import QWebSettings
@ -319,7 +320,7 @@ class WebView(QWebView):
clipboard_data = clipboard.mimeData() clipboard_data = clipboard.mimeData()
new_clipboard_data = QMimeData() new_clipboard_data = QMimeData()
for mimetype in clipboard_data.formats(): for mimetype in clipboard_data.formats():
data = clipboard_data.data(mimetype) data = QByteArray(clipboard_data.data(mimetype))
new_clipboard_data.setData(mimetype, data) new_clipboard_data.setData(mimetype, data)
clipboard.setMimeData(selection_data) clipboard.setMimeData(selection_data)