Fix tablet button crash

This commit is contained in:
Brad Davis 2017-07-28 09:33:02 -07:00
parent d572510770
commit 3d0c13915a

View file

@ -825,7 +825,13 @@ TabletButtonProxy::~TabletButtonProxy() {
void TabletButtonProxy::setQmlButton(QQuickItem* qmlButton) {
Q_ASSERT(QThread::currentThread() == qApp->thread());
if (_qmlButton) {
QObject::disconnect(_qmlButton, &QQuickItem::destroyed, this, nullptr);
}
_qmlButton = qmlButton;
if (_qmlButton) {
QObject::connect(_qmlButton, &QQuickItem::destroyed, this, [this] { _qmlButton = nullptr; });
}
}
void TabletButtonProxy::setToolbarButtonProxy(QObject* toolbarButtonProxy) {