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

Segfault if QML is bound to a property that raises an exception

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 6.5.1.1
    • PySide
    • None
    • Linux/X11

    Description

      If your QML application binds to a property that raises an exception, the application crashes with a segfault. Is there any way this could be handled more gracefully, either on the python side or on the QML side?

      As a simple example, you can simply bind to a property like:

      @Property(str, constant=True)
      def my_property(self):
          raise ValueError

      As soon as QML needs to read that property, python will raise the exception, and the app will crash with a segfault. In order to avoid this, you could wrap every single property in a try-except that scrubs all exceptions, but that would be a mess on a large existing project. Is there somewhere that the @Property decorator could be modified to handle exceptions? And by "handle exceptions" here, I don't mean do anything particularly special. That would be up to the developer, but some uncontroversial thing like just letting python print a traceback before crashing would be an improvement, otherwise the user doesn't get any feedback about what happened and it's hard for a developer to track down.

      In fact, even just printing an error in the QML console would work.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            malocascio Mark Locascio
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes