diff options
Diffstat (limited to 'vcl/unx/gtk3/gtkinst.cxx')
-rw-r--r-- | vcl/unx/gtk3/gtkinst.cxx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx index 8cb71eae9554..1790537725cf 100644 --- a/vcl/unx/gtk3/gtkinst.cxx +++ b/vcl/unx/gtk3/gtkinst.cxx @@ -1571,11 +1571,12 @@ void VclGtkClipboard::removeClipboardListener( const Reference< datatransfer::cl // We run unit tests in parallel, which is a problem when touching a shared resource // the system clipboard, so rather use the dummy GenericClipboard. -const bool bRunningUnitTest = getenv("LO_TESTNAME"); +// Note, cannot make this a global variable, because it might be initialised BEFORE the putenv() call in cppunittester. +static bool IsRunningUnitTest() { return getenv("LO_TESTNAME") != nullptr; } Reference< XInterface > GtkInstance::CreateClipboard(const Sequence< Any >& arguments) { - if ( bRunningUnitTest ) + if ( IsRunningUnitTest() ) return SalInstance::CreateClipboard( arguments ); OUString sel; @@ -1743,7 +1744,7 @@ void GtkInstDropTarget::setDefaultActions(sal_Int8 nDefaultActions) Reference< XInterface > GtkInstance::CreateDropTarget() { - if ( bRunningUnitTest ) + if ( IsRunningUnitTest() ) return SalInstance::CreateDropTarget(); return Reference<XInterface>(static_cast<cppu::OWeakObject*>(new GtkInstDropTarget)); @@ -1815,7 +1816,7 @@ css::uno::Sequence<OUString> SAL_CALL GtkInstDragSource::getSupportedServiceName Reference< XInterface > GtkInstance::CreateDragSource() { - if ( bRunningUnitTest ) + if ( IsRunningUnitTest() ) return SalInstance::CreateDragSource(); return Reference< XInterface >( static_cast<cppu::OWeakObject *>(new GtkInstDragSource()) ); |