From 8c02ef69ecf6ed58f0069012311229f55040ec54 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 27 Sep 2022 11:01:58 +0200 Subject: Add extra logging for calling into fusion style See https://github.com/qutebrowser/qutebrowser/issues/5124 --- qutebrowser/mainwindow/tabwidget.py | 16 ++++++++++++++-- 1 file 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. -- cgit v1.2.3-54-g00ecf