Skip to content
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

RdMentalMap getters are not thread-safe #2

Open
David-Estevez opened this issue Oct 24, 2014 · 0 comments
Open

RdMentalMap getters are not thread-safe #2

David-Estevez opened this issue Oct 24, 2014 · 0 comments

Comments

@David-Estevez
Copy link
Collaborator

Currently, the getters of the RdMentalMap are not thread-safe, so they may have problems when running in different threads.

@David-Estevez David-Estevez removed the bug label Feb 2, 2015
PeterBowman added a commit that referenced this issue Apr 16, 2017
One could still create copies with the following code:

// Create singleton
MockImageManager::RegisterManager();
ImageManager * im = ImageManager::getImageManager(MockImageManager::id);

// Violate singleton's contract with copy constructor
MockImageManager * temp = (MockImageManager*)im; // for conciseness
MockImageManager mim1(*temp);                         // copy-ctor #1
MockImageManager mim2 = *temp;                        // copy-ctor #2
MockImageManager mim3 = MockImageManager(*temp);      // copy-ctor #3
MockImageManager *pmim = new MockImageManager(*temp); // copy-ctor #4

// Copy assignment operator
mim1 = mim3;

See also http://stackoverflow.com/a/6811055
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants