[PyQt] Segfault in QMenu.addAction when parent widget is deleted.
Yuya Nishihara
yuya at tcha.org
Sun Apr 6 04:22:28 BST 2014
On Sat, 5 Apr 2014 12:26:38 -0700, J Robert Ray wrote:
> I suppose the implied solution is to create the
> submenu via python and add it to the parent menu. We've restructured our
> code to avoid this situation.
or connect async RPC result to widget's slot.
> > On 02-04-2014 9:11 pm, J Robert Ray wrote:
> >> In boils down to trying to add a new action to a submenu of a menu
> >> attached to a widget that has been deleted. Were having this problem
> >> due to some asynchronous RPC and getting results back after a user has
> >> caused the widget to go away.
class Widget(QWidget):
@pyqtSlot()
def cb(self):
self.sub.addAction(...)
# will be disconnected if widget is deleted
rpcservice.resultReady.connect(widget.cb)
instead of
def cb():
sub.addAction(...)
# "sub" may be deleted but "cb" won't
rpcservice.resultReady.connect(cb)
Regards,
More information about the PyQt
mailing list