mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-16 18:52:25 +01:00
Fix crash on Mac OS X, accessing stdout during static initialisation.
This commit is contained in:
parent
7293c9785a
commit
06f3b505ec
@ -126,19 +126,22 @@ namespace Catch {
|
|||||||
void use( Colour::Code ) {}
|
void use( Colour::Code ) {}
|
||||||
};
|
};
|
||||||
NoColourImpl noColourImpl;
|
NoColourImpl noColourImpl;
|
||||||
static const bool shouldUseColour = shouldUseColourForPlatform() &&
|
|
||||||
!isDebuggerActive();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Colour::Colour( Code _colourCode ){ use( _colourCode ); }
|
Colour::Colour( Code _colourCode ){ use( _colourCode ); }
|
||||||
Colour::~Colour(){ use( None ); }
|
Colour::~Colour(){ use( None ); }
|
||||||
void Colour::use( Code _colourCode ) {
|
void Colour::use( Code _colourCode ) {
|
||||||
|
|
||||||
|
if (impl == NULL) {
|
||||||
|
impl = (shouldUseColourForPlatform() && !isDebuggerActive())
|
||||||
|
? static_cast<Detail::IColourImpl*>( &platformColourImpl )
|
||||||
|
: static_cast<Detail::IColourImpl*>( &noColourImpl );
|
||||||
|
}
|
||||||
|
|
||||||
impl->use( _colourCode );
|
impl->use( _colourCode );
|
||||||
}
|
}
|
||||||
|
|
||||||
Detail::IColourImpl* Colour::impl = shouldUseColour
|
Detail::IColourImpl* Colour::impl = NULL;
|
||||||
? static_cast<Detail::IColourImpl*>( &platformColourImpl )
|
|
||||||
: static_cast<Detail::IColourImpl*>( &noColourImpl );
|
|
||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user