Skip to content

Commit 38204ca

Browse files
deepin-ci-robot18202781743
authored andcommitted
sync: from linuxdeepin/dtkcore
Synchronize source files from linuxdeepin/dtkcore. Source-pull-request: linuxdeepin/dtkcore#509
1 parent 0d20c11 commit 38204ca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/dconfig.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,16 @@ class Q_DECL_HIDDEN DBusBackend : public DConfigBackend
326326
DSGConfig dsg_config(DSG_CONFIG, "/", QDBusConnection::systemBus());
327327
QDBusPendingReply<QDBusObjectPath> dbus_reply = dsg_config.acquireManager(owner->appId, owner->name, owner->subpath);
328328
const QDBusObjectPath dbus_path = dbus_reply.value();
329-
if (dbus_reply.isError() || dbus_path.path().isEmpty()) {
329+
const auto path = dbus_path.path(); // 显式拷贝,避免其它线程共用systemBus连接而修改dbus数据
330+
if (dbus_reply.isError() || path.isEmpty()) {
330331
qCWarning(cfLog, "Can't acquire config manager. error:\"%s\"", qPrintable(dbus_reply.error().message()));
331332
return false;
332333
} else {
333-
qCDebug(cfLog(), "dbus path=\"%s\"", qPrintable(dbus_path.path()));
334-
config.reset(new DSGConfigManager(DSG_CONFIG_MANAGER, dbus_path.path(),
334+
qCDebug(cfLog, "dbus path=\"%s\"", qPrintable(path));
335+
config.reset(new DSGConfigManager(DSG_CONFIG_MANAGER, path,
335336
QDBusConnection::systemBus(), owner->q_func()));
336337
if (!config->isValid()) {
337-
qCWarning(cfLog(), "Can't acquire config path=\"%s\"", qPrintable(dbus_path.path()));
338+
qCWarning(cfLog, "Can't acquire config path=\"%s\"", qPrintable(path));
338339
config.reset();
339340
return false;
340341
} else {

0 commit comments

Comments
 (0)