diff --git a/src/mbgl/map/environment.cpp b/src/mbgl/map/environment.cpp index d121f9655..f2112c61b 100644 --- a/src/mbgl/map/environment.cpp +++ b/src/mbgl/map/environment.cpp @@ -36,10 +36,7 @@ public: void registerThread(Environment* env, ThreadType type, const std::string& name) { std::lock_guard lock(mtx); - // FIXME: We should never need to overwrite a thread here and we only allow - // this today because on the Static mode, the Map thread and the Main thread - // are same. Replace this with emplace() when this gets fixed. - threadSet[std::this_thread::get_id()] = ThreadInfo{ env, type, name }; + threadSet.emplace(std::this_thread::get_id(), ThreadInfo{ env, type, name }); } void unregisterThread() { diff --git a/test/miscellaneous/map_context.cpp b/test/miscellaneous/map_context.cpp index 0b465aa3c..95fbf7b9a 100644 --- a/test/miscellaneous/map_context.cpp +++ b/test/miscellaneous/map_context.cpp @@ -1,22 +1,24 @@ #include "../fixtures/util.hpp" -#include #include #include #include #include #include +#include using namespace mbgl; TEST(MapContext, DoubleStyleLoad) { - util::RunLoop runLoop(uv_default_loop()); std::shared_ptr display = std::make_shared(); HeadlessView view(display, 512, 512, 1); DefaultFileSource fileSource(nullptr); MapData data(view, MapMode::Continuous); - MapContext context(uv_default_loop(), view, fileSource, data); - context.setStyleJSON("", ""); - context.setStyleJSON("", ""); + std::unique_ptr> context( + util::make_unique>( + "Map", util::ThreadPriority::Regular, view, fileSource, data)); + + context->invokeSync(&MapContext::setStyleJSON, "", ""); + context->invokeSync(&MapContext::setStyleJSON, "", ""); }