From b849fdead5b3c7c8c429895c8cffe57179359dd4 Mon Sep 17 00:00:00 2001 From: Aetf Date: Fri, 24 Jan 2020 11:38:03 -0500 Subject: [PATCH] FdoSecrets: fix new db created from DBus but not saved yet is not exposed by default --- src/fdosecrets/objects/Collection.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/fdosecrets/objects/Collection.cpp b/src/fdosecrets/objects/Collection.cpp index c961f9b48..9997f4576 100644 --- a/src/fdosecrets/objects/Collection.cpp +++ b/src/fdosecrets/objects/Collection.cpp @@ -442,6 +442,16 @@ namespace FdoSecrets QString Collection::name() const { + if (m_backendPath.isEmpty()) { + // This is a newly created db without saving to file. + // This name is also used to register dbus path. + // For simplicity, we don't monitor the name change. + // So the dbus object path is not updated if the db name + // changes. This should not be a problem because once the database + // gets saved, the dbus path will be updated to use filename and + // everything back to normal. + return m_backend->database()->metadata()->name(); + } return QFileInfo(m_backendPath).baseName(); } @@ -546,8 +556,9 @@ namespace FdoSecrets } // repopulate - Q_ASSERT(!backendLocked()); - populateContents(); + if (!backendLocked()) { + populateContents(); + } } void Collection::onEntryAdded(Entry* entry, bool emitSignal)