-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EMSUSD-622 - As a user, I'd like to add a relative sublayer on a anonymous layer #3353
Conversation
lib/mayaUsd/utils/utilFileSystem.cpp
Outdated
@@ -48,6 +48,9 @@ std::string generateUniqueName() | |||
} | |||
return uniqueName; | |||
} | |||
|
|||
static std::map<PXR_NS::SdfLayerHandle, std::set<ghc::filesystem::path>> sPostponedRelativePaths; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that it is not multi-thread safe anyway, but just for order-of-initilization of C++ globals, it is a better practice to put the static variable inside a static function that returns it because the C++ language standard guarantee hat the static will be initialized on first call (which avoid the order of init of globals problem) and ensure that this init is thread-safe.
So something like:
using RelativePaths = std::map<PXR_NS::SdfLayerHandle, std::set<ghc::filesystem::path>>;
static RelativePaths& getRelativePaths()
{
static RelativePaths sPaths;
return sPaths;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small change requested to make it safer vs C++ link order.
Otherwise, looks good to me.
No description provided.