[Cppunit-devel] synchronization and TestResult
Brought to you by:
blep
From: Baptiste L. <bl...@cl...> - 2001-06-10 14:37:56
|
I'm writing the unit tests for the major classes of CppUnit. While writing test for TestResult, I stumbled uppon: std::vector<TestFailure *>& TestResult::failures () { ExclusiveZone zone (m_syncObject); return m_failures; } While the method is synchronized, it returns a reference on the vector making the synchronization useless. Changing this to: std::vector<TestFailure *> TestResult::failures () would solve the problem. Returning by value ensure that the returned vector will stay unmodified. Anybody see a better solution to this problem ? Baptiste. --- Baptiste Lepilleur <gai...@fr...> http://gaiacrtn.free.fr/index.html Author of The Text Reformatter, a tool for fanfiction readers and writers. Language: English, French (Well, I'm French). |