diff --git a/src/ringdht/ringaccount.cpp b/src/ringdht/ringaccount.cpp
index 89d83fa91a956ce5fd67e65599120f28d9509f55..bcc4ed899383150a55affb7df8517d4e5d910954 100644
--- a/src/ringdht/ringaccount.cpp
+++ b/src/ringdht/ringaccount.cpp
@@ -1980,6 +1980,7 @@ RingAccount::onTrackedBuddyOffline(std::map<dht::InfoHash, BuddyInfo>::iterator&
 void
 RingAccount::doRegister_()
 {
+    std::lock_guard<std::mutex> lock(registerMtx_);
     try {
         if (not identity_.first or not identity_.second)
             throw std::runtime_error("No identity configured for this account.");
@@ -2460,6 +2461,8 @@ RingAccount::replyToIncomingIceMsg(const std::shared_ptr<SIPCall>& call,
 void
 RingAccount::doUnregister(std::function<void(bool)> released_cb)
 {
+    std::lock_guard<std::mutex> lock(registerMtx_);
+
     if (registrationState_ == RegistrationState::INITIALIZING
      || registrationState_ == RegistrationState::ERROR_NEED_MIGRATION) {
         if (released_cb) released_cb(false);
diff --git a/src/ringdht/ringaccount.h b/src/ringdht/ringaccount.h
index 86e7991a8845666db9c7f701505729f9ec15ddb2..bbf200df3b0f6cc3b8e194373d63e5ec52fa132b 100644
--- a/src/ringdht/ringaccount.h
+++ b/src/ringdht/ringaccount.h
@@ -409,6 +409,7 @@ class RingAccount : public SIPAccountBase {
          */
         void onTrackedBuddyOnline(std::map<dht::InfoHash, BuddyInfo>::iterator& buddy_info_it, const dht::InfoHash& device_id);
 
+        std::mutex registerMtx_;
         void doRegister_();
         void incomingCall(dht::IceCandidates&& msg, const std::shared_ptr<dht::crypto::Certificate>& from_cert, const dht::InfoHash& from);