Fix build (with clang at least)

Summary:
No need to capture the variable as it's static. Also apparently wrong.
Used to get the following error message:
/home/apol/devel/frameworks/kwin/libinput/connection.cpp:103:56: error: 's_self' cannot be captured because it does not have automatic storage duration
    connect(s_self, &Connection::deviceAdded, s_self, [s_self](Device* device) {
                                                       ^
/home/apol/devel/frameworks/kwin/libinput/connection.cpp:45:25: note: 's_self' declared here
Connection *Connection::s_self = nullptr;
                        ^
/home/apol/devel/frameworks/kwin/libinput/connection.cpp:106:58: error: 's_self' cannot be captured because it does not have automatic storage duration
    connect(s_self, &Connection::deviceRemoved, s_self, [s_self](Device* device) {
                                                         ^
/home/apol/devel/frameworks/kwin/libinput/connection.cpp:45:25: note: 's_self' declared here
Connection *Connection::s_self = nullptr;
                        ^

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3703
This commit is contained in:
Aleix Pol 2016-12-16 12:56:12 +01:00
parent 62b4517f1d
commit 1f5356e609

View file

@ -100,10 +100,10 @@ Connection *Connection::create(QObject *parent)
QObject::connect(s_thread, &QThread::finished, s_thread, &QObject::deleteLater); QObject::connect(s_thread, &QThread::finished, s_thread, &QObject::deleteLater);
QObject::connect(parent, &QObject::destroyed, s_thread, &QThread::quit); QObject::connect(parent, &QObject::destroyed, s_thread, &QThread::quit);
connect(s_self, &Connection::deviceAdded, s_self, [s_self](Device* device) { connect(s_self, &Connection::deviceAdded, s_self, [](Device* device) {
emit s_self->deviceAddedSysName(device->sysName()); emit s_self->deviceAddedSysName(device->sysName());
}); });
connect(s_self, &Connection::deviceRemoved, s_self, [s_self](Device* device) { connect(s_self, &Connection::deviceRemoved, s_self, [](Device* device) {
emit s_self->deviceRemovedSysName(device->sysName()); emit s_self->deviceRemovedSysName(device->sysName());
}); });
return s_self; return s_self;