From 4caec2becbfb7156d58643ec083106adf3f31633 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 2 Sep 2014 20:44:58 +0200 Subject: [PATCH] Document and mark workarounds. --- qutebrowser/browser/commands.py | 2 ++ qutebrowser/browser/webpage.py | 11 ++++++++--- qutebrowser/keyinput/modeman.py | 1 + qutebrowser/network/networkmanager.py | 2 ++ qutebrowser/utils/earlyinit.py | 2 ++ qutebrowser/utils/log.py | 1 + qutebrowser/utils/qtutils.py | 1 + qutebrowser/utils/urlutils.py | 2 ++ qutebrowser/utils/utils.py | 3 ++- qutebrowser/widgets/completion.py | 3 ++- qutebrowser/widgets/statusbar/textbase.py | 9 ++++++++- 11 files changed, 31 insertions(+), 6 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 016b32bb7..f7733918f 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -207,6 +207,7 @@ class CommandDispatcher: count: The tab index to print, or None. """ if not qtutils.check_print_compat(): + # WORKAROUND (remove this when we bump the requirements to 5.3.0) raise cmdexc.CommandError( "Printing on Qt < 5.3.0 on Windows is broken, please upgrade!") tab = self._tabs.cntwidget(count) @@ -224,6 +225,7 @@ class CommandDispatcher: count: The tab index to print, or None. """ if not qtutils.check_print_compat(): + # WORKAROUND (remove this when we bump the requirements to 5.3.0) raise cmdexc.CommandError( "Printing on Qt < 5.3.0 on Windows is broken, please upgrade!") tab = self._tabs.cntwidget(count) diff --git a/qutebrowser/browser/webpage.py b/qutebrowser/browser/webpage.py index 09e264de6..ccd45b790 100644 --- a/qutebrowser/browser/webpage.py +++ b/qutebrowser/browser/webpage.py @@ -65,7 +65,7 @@ class BrowserPage(QWebPage): self._view = view if PYQT_VERSION > 0x050300: - # This is broken in Qt <= 5.3.0. + # WORKAROUND (remove this when we bump the requirements to 5.3.1) # See http://www.riverbankcomputing.com/pipermail/pyqt/2014-June/034385.html # pylint: disable=invalid-name self.javaScriptPrompt = self._javascript_prompt @@ -242,14 +242,19 @@ class BrowserPage(QWebPage): return super().extension(ext, opt, out) return handler(opt, out) except: # pylint: disable=bare-except - # Due to a bug in PyQt, exceptions inside extension() get swallowed - # for some reason. + # WORKAROUND: + # + # Due to a bug in PyQt, exceptions inside extension() get + # swallowed: # http://www.riverbankcomputing.com/pipermail/pyqt/2014-August/034722.html # # We used to re-raise the exception with a single-shot QTimer here, # but that lead to a strange proble with a KeyError with some # random jinja template stuff as content. For now, we only log it, # so it doesn't pass 100% silently. + # + # FIXME: This should be fixed with PyQt 5.3.2 - re-check when it's + # out and raise the exception normally if possible. log.webview.exception("Error inside WebPage::extension") return False diff --git a/qutebrowser/keyinput/modeman.py b/qutebrowser/keyinput/modeman.py index 996eddc29..72d81e5fb 100644 --- a/qutebrowser/keyinput/modeman.py +++ b/qutebrowser/keyinput/modeman.py @@ -114,6 +114,7 @@ class ModeManager(QObject): @property def mode(self): """Read-only property for the current mode.""" + # WORKAROUND # For some reason, on Ubuntu (Python 3.3.2, PyQt 5.0.1, Qt 5.0.2) there # is a lingering exception here sometimes. With this construct, we # clear this exception which makes no sense at all anyways. diff --git a/qutebrowser/network/networkmanager.py b/qutebrowser/network/networkmanager.py index cea677f70..2e33f65a5 100644 --- a/qutebrowser/network/networkmanager.py +++ b/qutebrowser/network/networkmanager.py @@ -146,6 +146,8 @@ class NetworkManager(QNetworkAccessManager): req.setRawHeader('Accept-Language'.encode('ascii'), accept_language.encode('ascii')) if PYQT_VERSION < 0x050301: + # WORKAROUND (remove this when we bump the requirements to 5.3.1) + # # If we don't disable our message handler, we get a freeze if a # warning is printed due to a PyQt bug, e.g. when clicking a # currency on http://ch.mouser.com/localsites/ diff --git a/qutebrowser/utils/earlyinit.py b/qutebrowser/utils/earlyinit.py index c78c01b43..4bf251f59 100644 --- a/qutebrowser/utils/earlyinit.py +++ b/qutebrowser/utils/earlyinit.py @@ -140,6 +140,8 @@ def fix_harfbuzz(args): IMPORTANT: This needs to be done before QWidgets is imported in any way! + WORKAROUND (remove this when we bump the requirements to 5.3.1) + Args: args: The argparse namespace. """ diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index ee9382646..f27f5325b 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -41,6 +41,7 @@ try: except ImportError: colorlog = None else: + # WORKAROUND # colorlog calls colorama.init() which we don't want, also it breaks our # sys.stdout/sys.stderr if they are None. Bugreports: # https://code.google.com/p/colorama/issues/detail?id=61 diff --git a/qutebrowser/utils/qtutils.py b/qutebrowser/utils/qtutils.py index 146fa5d62..a2a3c4b6a 100644 --- a/qutebrowser/utils/qtutils.py +++ b/qutebrowser/utils/qtutils.py @@ -114,6 +114,7 @@ def get_args(namespace): def check_print_compat(): """Check if printing should work in the given Qt version.""" + # WORKAROUND (remove this when we bump the requirements to 5.3.0) return not (os.name == 'nt' and version_check('5.3.0', operator.lt)) diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py index e27c16a8f..b2e33850d 100644 --- a/qutebrowser/utils/urlutils.py +++ b/qutebrowser/utils/urlutils.py @@ -232,6 +232,8 @@ def qurl_from_user_input(urlstr): IPv6, so we first try to handle it as a valid IPv6, and if that fails we use QUrl.fromUserInput. + WORKAROUND - https://bugreports.qt-project.org/browse/QTBUG-41089 + Args: urlstr: The URL as string. diff --git a/qutebrowser/utils/utils.py b/qutebrowser/utils/utils.py index a7e50e7c4..c790e6410 100644 --- a/qutebrowser/utils/utils.py +++ b/qutebrowser/utils/utils.py @@ -170,7 +170,7 @@ def get_standard_dir(typ): appname = qapp.applicationName() if (typ == QStandardPaths.ConfigLocation and path.split(os.sep)[-1] != appname): - # Workaround for + # WORKAROUND - see # https://bugreports.qt-project.org/browse/QTBUG-38872 path = os.path.join(path, appname) if not os.path.exists(path): @@ -182,6 +182,7 @@ def get_standard_dir(typ): def actute_warning(): """Display a warning about the dead_actute issue if needed.""" + # WORKAROUND (remove this when we bump the requirements to 5.3.0) # Non linux OS' aren't affected if not sys.platform.startswith('linux'): return diff --git a/qutebrowser/widgets/completion.py b/qutebrowser/widgets/completion.py index 1e3b776ac..9594d800c 100644 --- a/qutebrowser/widgets/completion.py +++ b/qutebrowser/widgets/completion.py @@ -104,7 +104,8 @@ class CompletionView(QTreeView): self.setItemsExpandable(False) self.setExpandsOnDoubleClick(False) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) - # QTBUG? This is a workaround for weird race conditions with invalid + # WORKAROUND + # This is a workaround for weird race conditions with invalid # item indexes leading to segfaults in Qt. # # Some background: http://bugs.quassel-irc.org/issues/663 diff --git a/qutebrowser/widgets/statusbar/textbase.py b/qutebrowser/widgets/statusbar/textbase.py index 249769e55..92fe3a56d 100644 --- a/qutebrowser/widgets/statusbar/textbase.py +++ b/qutebrowser/widgets/statusbar/textbase.py @@ -65,7 +65,13 @@ class TextBase(QLabel): This update the elided text after setting the text, and also works around a weird QLabel redrawing bug where it doesn't redraw correctly when the text is empty -- we explicitely need to call repaint() to - resolve this. See http://stackoverflow.com/q/21890462/2085149 + resolve this. + + More info: + + http://stackoverflow.com/q/21890462/2085149 + https://bugreports.qt-project.org/browse/QTBUG-36945 + https://codereview.qt-project.org/#/c/79181/ Args: txt: The text to set (string). @@ -73,6 +79,7 @@ class TextBase(QLabel): super().setText(txt) self._update_elided_text(self.geometry().width()) if not txt: + # WORKAROUND self.repaint() def resizeEvent(self, e):