diff options
author | Florian Bruhin <me@the-compiler.org> | 2022-09-27 11:01:58 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2022-09-27 11:01:58 +0200 |
commit | 8c02ef69ecf6ed58f0069012311229f55040ec54 (patch) | |
tree | 411f28cc90f1542adffb7b1227a998d570d8093f | |
parent | f39f6bc0a95d1f2924b8db01493fe289da02c702 (diff) | |
download | qutebrowser-8c02ef69ecf6ed58f0069012311229f55040ec54.tar.gz qutebrowser-8c02ef69ecf6ed58f0069012311229f55040ec54.zip |
Add extra logging for calling into fusion style
See https://github.com/qutebrowser/qutebrowser/issues/5124
-rw-r--r-- | qutebrowser/mainwindow/tabwidget.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 604b9eebd..f5446e963 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -805,10 +805,22 @@ class TabBarStyle(QCommonStyle): 'itemPixmapRect', 'itemTextRect', 'polish', 'styleHint', 'subControlRect', 'unpolish', 'drawItemText', 'sizeFromContents', 'drawPrimitive']: - target = getattr(self._style, method) - setattr(self, method, functools.partial(target)) + setattr(self, method, functools.partial(self._fusion_call, method)) super().__init__() + def _fusion_call(self, method: str, *args: Any) -> Any: + """Wrap a call to self._style to log RuntimeErrors. + + WORKAROUND for https://github.com/qutebrowser/qutebrowser/issues/5124 + """ + target = getattr(self._style, method) + try: + return target(*args) + except RuntimeError: + info = f"self._style.{method}{args}" + log.misc.warning(f"Got RuntimeError while calling {info}") + raise + def _draw_indicator(self, layouts, opt, p): """Draw the tab indicator. |