diff --git a/dnf5daemon-server/services/goal/goal.cpp b/dnf5daemon-server/services/goal/goal.cpp index 38c079f6d..1803ea5ef 100644 --- a/dnf5daemon-server/services/goal/goal.cpp +++ b/dnf5daemon-server/services/goal/goal.cpp @@ -121,6 +121,13 @@ void Goal::dbus_register() { } sdbus::MethodReply Goal::resolve(sdbus::MethodCall & call) { + auto & transaction_mutex = session.get_transaction_mutex(); + if (!transaction_mutex.try_lock()) { + //TODO(mblaha): use specialized exception class + throw std::runtime_error("Cannot acquire transaction lock (another transaction is running)."); + } + std::lock_guard transaction_lock(transaction_mutex, std::adopt_lock); + // read options from dbus call dnfdaemon::KeyValueMap options; call >> options;