[ATSPI][SVACE] Fixes use of v variable after it was freed by eldbus_service_interface... 86/260786/2
authorLukasz Oleksak <l.oleksak@samsung.com>
Fri, 2 Jul 2021 16:01:26 +0000 (18:01 +0200)
committerLukasz Oleksak <l.oleksak@samsung.com>
Fri, 2 Jul 2021 16:12:34 +0000 (16:12 +0000)
Change-Id: I44d89ab5532243ba79d212f0cb6ddd13289b34a8

automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/dbus-wrapper.cpp

index d59df19..9011f2f 100644 (file)
@@ -666,9 +666,11 @@ struct DefaultDBusWrapper : public DBusWrapper {
       DBUS_DEBUG( "registering interface %p (%d)", v, fallback ? 1 : 0 );
       destructors.push_back([=]() {
         DBUS_DEBUG( "unregistering interface %p", v );
+        {
+          std::lock_guard< std::mutex > lock( globalEntriesMutex );
+          globalEntries.erase( v );
+        }
         eldbus_service_interface_unregister( v );
-        std::lock_guard< std::mutex > lock( globalEntriesMutex );
-        globalEntries.erase( v );
       });
     }
   }