From a697b5584a949f35725f0f21666ff03f0e24b489 Mon Sep 17 00:00:00 2001 From: Marcel Schumacher Date: Tue, 14 Apr 2020 17:24:54 +0200 Subject: [PATCH] Fixed a possible race condition with linked views --- pyqtgraph/graphicsItems/AxisItem.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/pyqtgraph/graphicsItems/AxisItem.py b/pyqtgraph/graphicsItems/AxisItem.py index 6b2c63df..dcb74c8f 100644 --- a/pyqtgraph/graphicsItems/AxisItem.py +++ b/pyqtgraph/graphicsItems/AxisItem.py @@ -1098,23 +1098,26 @@ class AxisItem(GraphicsWidget): self._updateHeight() def wheelEvent(self, ev): - if self.linkedView() is None: + lv = self.linkedView() + if lv is None: return if self.orientation in ['left', 'right']: - self.linkedView().wheelEvent(ev, axis=1) + lv.wheelEvent(ev, axis=1) else: - self.linkedView().wheelEvent(ev, axis=0) + lv.wheelEvent(ev, axis=0) ev.accept() def mouseDragEvent(self, event): - if self.linkedView() is None: + lv = self.linkedView() + if lv is None: return if self.orientation in ['left', 'right']: - return self.linkedView().mouseDragEvent(event, axis=1) + return lv.mouseDragEvent(event, axis=1) else: - return self.linkedView().mouseDragEvent(event, axis=0) + return lv.mouseDragEvent(event, axis=0) def mouseClickEvent(self, event): - if self.linkedView() is None: + lv = self.linkedView() + if lv is None: return - return self.linkedView().mouseClickEvent(event) + return lv.mouseClickEvent(event)