From romain at ledisez.net Thu Nov 8 21:30:53 2018 From: romain at ledisez.net (Romain LE DISEZ) Date: Thu, 08 Nov 2018 21:30:53 +0100 Subject: [PySide] =?utf-8?q?Segfault_using_QScxmlStateMachine=2EsubmitEven?= =?utf-8?q?t=28QScxmlEvent=29?= Message-ID: <67fb-5be49d00-9-79b9c600@188517732> Hi all, I'm very new to Qt as I'm developing my first application with it. I'm trying to use StateChart based on QScxmlStateMachine. It works fine except in a situation where I get a segfault. If, in the demo code below, you comment the line submitEvent('MY_EVENT') and uncomment the usage of a ScxmlEvent, the event is dispatched then the application segfaults. Output is: StateMachine::active: True ('MY_EVENT:', (), {}) Segmentation fault: 11 Am I doing something wrong or is it a bug? How can I provide you useful informations in the latter case. I'm running PySide2 (v5.11.2) on macOS (High Sierra) with Python v2.7.15 (coming from brew). Thx for your help. demo.scxml: demo.py: #!/usr/bin/env python import sys from PySide2.QtCore import QObject, QCoreApplication, SLOT, Slot from PySide2.QtScxml import QScxmlStateMachine, QScxmlEvent class Backend(QObject): def __init__(self, machine): super(Backend, self).__init__() self.machine = machine self.machine.connectToState('StateMachine', self, SLOT('state_machine_active(bool)')) self.machine.connectToEvent('MY_EVENT', self, SLOT('my_event()')) @Slot(bool) def state_machine_active(self, active): print('StateMachine::active: %s' % active) self.machine.submitEvent('MY_EVENT') #ev = QScxmlEvent() #ev.setName('MY_EVENT') #ev.setEventType(QScxmlEvent.ExternalEvent) #self.machine.submitEvent(ev) @Slot() def my_event(self, *args, **kwargs): print('MY_EVENT:', args, kwargs) if __name__ == '__main__': app = QCoreApplication(sys.argv) machine = QScxmlStateMachine.fromFile('demo.scxml') b = Backend(machine) machine.start() sys.exit(app.exec_()) -- Romain From alexander.blasche at qt.io Fri Nov 9 07:53:28 2018 From: alexander.blasche at qt.io (Alex Blasche) Date: Fri, 9 Nov 2018 06:53:28 +0000 Subject: [PySide] Segfault using QScxmlStateMachine.submitEvent(QScxmlEvent) In-Reply-To: <67fb-5be49d00-9-79b9c600@188517732> References: <67fb-5be49d00-9-79b9c600@188517732> Message-ID: Hi Romain, please file a bugreport under bugreports.qt.io in the Pyside project. The content for the bug report you already have in your mail. If you happen to have a stack trace, that would be beneficial too. Alex ________________________________________ From: PySide on behalf of Romain LE DISEZ Sent: Thursday, 8 November 2018 9:30:53 PM To: pyside at qt-project.org Subject: [PySide] Segfault using QScxmlStateMachine.submitEvent(QScxmlEvent) Hi all, I'm very new to Qt as I'm developing my first application with it. I'm trying to use StateChart based on QScxmlStateMachine. It works fine except in a situation where I get a segfault. If, in the demo code below, you comment the line submitEvent('MY_EVENT') and uncomment the usage of a ScxmlEvent, the event is dispatched then the application segfaults. Output is: StateMachine::active: True ('MY_EVENT:', (), {}) Segmentation fault: 11 Am I doing something wrong or is it a bug? How can I provide you useful informations in the latter case. I'm running PySide2 (v5.11.2) on macOS (High Sierra) with Python v2.7.15 (coming from brew). Thx for your help. demo.scxml: demo.py: #!/usr/bin/env python import sys from PySide2.QtCore import QObject, QCoreApplication, SLOT, Slot from PySide2.QtScxml import QScxmlStateMachine, QScxmlEvent class Backend(QObject): def __init__(self, machine): super(Backend, self).__init__() self.machine = machine self.machine.connectToState('StateMachine', self, SLOT('state_machine_active(bool)')) self.machine.connectToEvent('MY_EVENT', self, SLOT('my_event()')) @Slot(bool) def state_machine_active(self, active): print('StateMachine::active: %s' % active) self.machine.submitEvent('MY_EVENT') #ev = QScxmlEvent() #ev.setName('MY_EVENT') #ev.setEventType(QScxmlEvent.ExternalEvent) #self.machine.submitEvent(ev) @Slot() def my_event(self, *args, **kwargs): print('MY_EVENT:', args, kwargs) if __name__ == '__main__': app = QCoreApplication(sys.argv) machine = QScxmlStateMachine.fromFile('demo.scxml') b = Backend(machine) machine.start() sys.exit(app.exec_()) -- Romain _______________________________________________ PySide mailing list PySide at qt-project.org http://lists.qt-project.org/mailman/listinfo/pyside From public at enkore.de Fri Nov 9 12:43:28 2018 From: public at enkore.de (Marian Beermann) Date: Fri, 9 Nov 2018 12:43:28 +0100 Subject: [PySide] Segfault using QScxmlStateMachine.submitEvent(QScxmlEvent) In-Reply-To: References: <67fb-5be49d00-9-79b9c600@188517732> Message-ID: <157015dc-daf9-9c5d-db07-bcbe4739c0bd@enkore.de> You might be able to get a stacktrace using the "faulthandler" module (standard in Python 3, needs to be installed from PyPI for Python 2). Am 09.11.18 um 07:53 schrieb Alex Blasche: > Hi Romain, > > please file a bugreport under bugreports.qt.io in the Pyside project. The content for the bug report you already have in your mail. If you happen to have a stack trace, that would be beneficial too. > > Alex > > ________________________________________ > From: PySide on behalf of Romain LE DISEZ > Sent: Thursday, 8 November 2018 9:30:53 PM > To: pyside at qt-project.org > Subject: [PySide] Segfault using QScxmlStateMachine.submitEvent(QScxmlEvent) > > Hi all, > > I'm very new to Qt as I'm developing my first application with it. I'm trying to use StateChart based on QScxmlStateMachine. > > It works fine except in a situation where I get a segfault. If, in the demo code below, you comment the line submitEvent('MY_EVENT') and uncomment the usage of a ScxmlEvent, the event is dispatched then the application segfaults. Output is: > StateMachine::active: True > ('MY_EVENT:', (), {}) > Segmentation fault: 11 > > Am I doing something wrong or is it a bug? How can I provide you useful informations in the latter case. I'm running PySide2 (v5.11.2) on macOS (High Sierra) with Python v2.7.15 (coming from brew). > > Thx for your help. > > > demo.scxml: > > > > > > > demo.py: > #!/usr/bin/env python > > import sys > > from PySide2.QtCore import QObject, QCoreApplication, SLOT, Slot > from PySide2.QtScxml import QScxmlStateMachine, QScxmlEvent > > > class Backend(QObject): > def __init__(self, machine): > super(Backend, self).__init__() > self.machine = machine > self.machine.connectToState('StateMachine', self, SLOT('state_machine_active(bool)')) > self.machine.connectToEvent('MY_EVENT', self, SLOT('my_event()')) > > @Slot(bool) > def state_machine_active(self, active): > print('StateMachine::active: %s' % active) > self.machine.submitEvent('MY_EVENT') > #ev = QScxmlEvent() > #ev.setName('MY_EVENT') > #ev.setEventType(QScxmlEvent.ExternalEvent) > #self.machine.submitEvent(ev) > > @Slot() > def my_event(self, *args, **kwargs): > print('MY_EVENT:', args, kwargs) > > > if __name__ == '__main__': > app = QCoreApplication(sys.argv) > > machine = QScxmlStateMachine.fromFile('demo.scxml') > b = Backend(machine) > machine.start() > > sys.exit(app.exec_()) > > -- > Romain > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside > _______________________________________________ > PySide mailing list > PySide at qt-project.org > http://lists.qt-project.org/mailman/listinfo/pyside >