Skip to content

Commit 018e23d

Browse files
committed
Fix segfault due to an internal cache mechanism
Fix #86
1 parent fe31462 commit 018e23d

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# PythonQwt Releases
22

3+
## Version 0.12.3
4+
5+
- Fixed `Fatal Python error` issue reported in the `PlotPy` project:
6+
- See [PlotPy's Issue #11](https://github.com/PlotPyStack/PlotPy/issues/11) for the
7+
original issue, even if the problem is not directly pointed out in the issue
8+
comments.
9+
- The issue was caused by the `QwtAbstractScaleDraw` cache mechanism, which was
10+
keeping references to `QSizeF` objects that were deleted by the garbage collector
11+
at some point. This was causing a segmentation fault, but only on Linux, and
12+
only when executing the `PlotPy` test suite in a specific order.
13+
- Thanks to @yuzibo for helping to reproduce the issue and providing a test case,
14+
that is the `PlotPy` Debian package build process.
15+
316
## Version 0.12.2
417

518
For this release, test coverage is 72%.

qwt/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
from qwt.text import QwtText # noqa: F401
5656
from qwt.toqimage import array_to_qimage as toQImage # noqa: F401
5757

58-
__version__ = "0.12.2"
58+
__version__ = "0.12.3"
5959
QWT_VERSION_STR = "6.1.5"
6060

6161

qwt/scale_draw.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,14 +438,13 @@ def tickLabel(self, font, value):
438438
:param float value: Value
439439
:return: Tuple (tick label, text size)
440440
"""
441-
lbl, tsize = self.__data.labelCache.get(value, (None, None))
441+
lbl = self.__data.labelCache.get(value)
442442
if lbl is None:
443443
lbl = QwtText(self.label(value))
444444
lbl.setRenderFlags(0)
445445
lbl.setLayoutAttribute(QwtText.MinimumLayout)
446-
tsize = lbl.textSize(font)
447-
self.__data.labelCache[value] = lbl, tsize
448-
return lbl, tsize
446+
self.__data.labelCache[value] = lbl
447+
return lbl, lbl.textSize(font)
449448

450449
def invalidateCache(self):
451450
"""

0 commit comments

Comments
 (0)