Commit 2c70ac2a authored by Elvis Angelaccio's avatar Elvis Angelaccio

Don't assume initialized if there are pending dbus replies

Summary:
ConnectionEditorBase::initialize() does not count the number of pending dbus
replies, so it is currently assuming that if control reaches the end of the
function, we are not waiting for secrets and we can claim the kcm is
initialized. That is not necessarily true, as bug #376739 shows.

If we count the number of replies actually received, we can be sure that there
are no more pending replies and we can then set m_initialized to true at the
end of initialize().

BUG: 376739
FIXED-IN: 5.9.3

Test Plan:
Open Connection KCM from systemsettings5, no longer had the Apply button
enabled. Playing with the KCM still enables the Apply button if something is
changed.

Reviewers: jgrulich

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D4705
parent 6be6918f
......@@ -66,6 +66,7 @@ ConnectionEditorBase::ConnectionEditorBase(const NetworkManager::ConnectionSetti
: QWidget(parent, f)
, m_initialized(false)
, m_valid(false)
, m_pendingReplies(0)
, m_connection(connection)
{
}
......@@ -400,6 +401,7 @@ void ConnectionEditorBase::initialize()
}
if (requestSecrets) {
m_pendingReplies++;
reply = connection->secrets(settingName);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
watcher->setProperty("connection", connection->name());
......@@ -414,7 +416,9 @@ void ConnectionEditorBase::initialize()
}
// We should be now fully initialized as we don't wait for secrets
m_initialized = true;
if (m_pendingReplies == 0) {
m_initialized = true;
}
}
void ConnectionEditorBase::replyFinished(QDBusPendingCallWatcher *watcher)
......@@ -452,6 +456,7 @@ void ConnectionEditorBase::replyFinished(QDBusPendingCallWatcher *watcher)
validChanged(true);
// We should be now fully with secrets
m_pendingReplies--;
m_initialized = true;
}
......
......@@ -74,6 +74,7 @@ protected:
private:
bool m_initialized;
bool m_valid;
int m_pendingReplies;
NetworkManager::ConnectionSettings::Ptr m_connection;
ConnectionWidget *m_connectionWidget;
QList<SettingWidget *> m_settingWidgets;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment