@@ -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