Don't pass an empty QPrinter to QPrintDialog.

This was garbage collected on Linux when the dialog was opened, leading
to segfaults when the printer was changed in the dialog.

But actually we don't need it at all, so we just drop it.
This commit is contained in:
Florian Bruhin 2014-05-06 18:31:08 +02:00
parent 0a38a21f21
commit 557805c8b2
2 changed files with 2 additions and 6 deletions

3
TODO
View File

@ -11,9 +11,6 @@ Before 0.1
Crashes Crashes
======= =======
- Chosing printer in :print gives us a segfault on Linux, but :printpreview
works...
- When following a hint: - When following a hint:
QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once. QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.

View File

@ -26,7 +26,7 @@ from functools import partial
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import pyqtSlot, Qt, QObject, QProcess from PyQt5.QtCore import pyqtSlot, Qt, QObject, QProcess
from PyQt5.QtGui import QClipboard from PyQt5.QtGui import QClipboard
from PyQt5.QtPrintSupport import QPrinter, QPrintDialog, QPrintPreviewDialog from PyQt5.QtPrintSupport import QPrintDialog, QPrintPreviewDialog
import qutebrowser.utils.url as urlutils import qutebrowser.utils.url as urlutils
import qutebrowser.utils.message as message import qutebrowser.utils.message as message
@ -180,8 +180,7 @@ class CurCommandDispatcher(QObject):
# If this isn't fixed in Qt 5.3, bug should be reopened. # If this isn't fixed in Qt 5.3, bug should be reopened.
tab = self._tabs.cntwidget(count) tab = self._tabs.cntwidget(count)
if tab is not None: if tab is not None:
printer = QPrinter() printdiag = QPrintDialog(tab)
printdiag = QPrintDialog(printer, tab)
printdiag.open(lambda: tab.print(printdiag.printer())) printdiag.open(lambda: tab.print(printdiag.printer()))
@cmdutils.register(instance='mainwindow.tabs.cur') @cmdutils.register(instance='mainwindow.tabs.cur')