FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Qt5 Segfaults on window resize · Issue #11728 · matplotlib/matplotlib · GitHub

Repository navigation

Qt5 Segfaults on window resize  #11728

Closed

Description

Bug report

On my machine using master I can reliably get segfaults using QT5Agg by resizing the window a bunch of times (say order 20). There is no segfault on v2.2.2 Suspect #11712 and/or #8951. (Sorry, not quite sure how to revert those locally to test).

python3.6_2018-07-21-150850_JMKMBP.crash.zip

import matplotlib.pyplot as plt
fig, ax = plt.subplots()
plt.show()

Matplotlib version

  • Operating system: macOS 10.13.6
  • Matplotlib version: master as of this AM.
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: 3.6.3

Activity

  1. added this to the v3.0 milestone on Jul 21, 2018
  2. added
    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
    on Jul 21, 2018
  3. anntzer commented on Jul 21, 2018

    Contributor

    Does

    diff --git a/lib/matplotlib/backends/backend_qt5agg.py b/lib/matplotlib/backends/backend_qt5agg.py
    index 6e0e964a8..b009187a4 100644
    --- a/lib/matplotlib/backends/backend_qt5agg.py
    +++ b/lib/matplotlib/backends/backend_qt5agg.py
    @@ -48,10 +48,9 @@ class FigureCanvasQTAgg(FigureCanvasAgg, FigureCanvasQT):
                 [[left, self.renderer.height - (top + height * self._dpi_ratio)],
                  [left + width * self._dpi_ratio, self.renderer.height - top]])
             reg = self.copy_from_bbox(bbox)
    -        buf = reg.to_string_argb()
    +        buf = memoryview(reg)
             qimage = QtGui.QImage(
    -            buf, width * self._dpi_ratio, height * self._dpi_ratio,
    -            QtGui.QImage.Format_ARGB32)
    +            buf, buf.shape[1], buf.shape[0], QtGui.QImage.Format_RGBA8888)
             if hasattr(qimage, 'setDevicePixelRatio'):
                 # Not available on Qt4 or some older Qt5.
                 qimage.setDevicePixelRatio(self._dpi_ratio)
    

    fix it for you? Basically the problem is that the bbox extents are floats, so there may be an off-by-one difference in rounding to get the image size. Format_RGBA8888 may appear as less efficient but in fact we save a copy by directly taking the underlying renderer buffer in memoryview(reg) so it comes down to the same.

  4. jklymak commented on Jul 21, 2018

    MemberAuthor

    Seems to, at least to the extent that I got bored of resizing the window w/ the GUI well past the point where I could make it die w/o that patch...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GUI: QtRelease criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL