Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-966

segfault: using matplotlib (debug) and pyside2 (debug)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.12.0, 5.12.1
    • PySide
    • None

    Description

      Using the following environment:

      • Python interpreter (3.7.2 and 3.6.8) built with
        --with-pydebug

        ,

      • matplotlib installed via pip
      • PySide2 build from source
         --debug --ignore-git --parallel=8  --make-spec=ninja --verbose-build --limited-api=no --skip-modules=RemoteObjects

      and trying to run the following code:

      import sys
      import time
      import numpy as np
      from matplotlib.backends.qt_compat import QtCore, QtWidgets
      from matplotlib.backends.backend_qt5agg import FigureCanvas
      from matplotlib.figure import Figure
      
      class ApplicationWindow(QtWidgets.QMainWindow):
          def __init__(self):
              super().__init__()
              self._main = QtWidgets.QWidget()
              self.setCentralWidget(self._main)
              layout = QtWidgets.QVBoxLayout(self._main)
      
              static_canvas = FigureCanvas(Figure(figsize=(5, 3)))
              layout.addWidget(static_canvas)
      
              dynamic_canvas = FigureCanvas(Figure(figsize=(5, 3)))
              layout.addWidget(dynamic_canvas)
      
              self._static_ax = static_canvas.figure.subplots()
              t = np.linspace(0, 10, 501)
              self._static_ax.plot(t, np.tan(t), ".")
      
              self._dynamic_ax = dynamic_canvas.figure.subplots()
              self._timer = dynamic_canvas.new_timer(
                  100, [(self._update_canvas, (), {})])
              self._timer.start()
      
          def _update_canvas(self):
              self._dynamic_ax.clear()
              t = np.linspace(0, 10, 101)
              # Shift the sinusoid as a function of time.
              self._dynamic_ax.plot(t, np.sin(t + time.time()))
              self._dynamic_ax.figure.canvas.draw()
      
      
      if __name__ == "__main__":
          print(QtCore.__file__)
          qapp = QtWidgets.QApplication(sys.argv)
          app = ApplicationWindow()
          app.show()
          qapp.exec_()
      

      (Source: https://matplotlib.org/examples/user_interfaces/embedding_in_qt5.html )

      generates a segmentation fault

      * ob
      object  : <refcnt 0 at 0x7fb28d5e0e50>
      type    : matplotlib.backends._backend_agg.BufferRegion
      refcount: 0
      address : 0x7fb28d5e0e50
      * op->_ob_prev->_ob_next
      zsh: segmentation fault (core dumped)  python matplotlib-pyside.py
      

      Attachments

        1. gdb.txt
          12 kB
        2. matplotlib-pyside.py
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            crmaurei Cristian Maureira-Fredes
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes