diff --git a/opencl/source/OpenCLZone.cxx b/opencl/source/OpenCLZone.cxx index 43ac31899c4d..01b50ed14a54 100644 --- a/opencl/source/OpenCLZone.cxx +++ b/opencl/source/OpenCLZone.cxx @@ -25,21 +25,21 @@ void OpenCLZone::hardDisable() { // protect ourselves from double calling etc. static bool bDisabled = false; - if (!bDisabled) - { - bDisabled = true; + if (bDisabled) + return; - std::shared_ptr xChanges(comphelper::ConfigurationChanges::create()); - officecfg::Office::Common::Misc::UseOpenCL::set(false, xChanges); - xChanges->commit(); + bDisabled = true; - // Force synchronous config write - auto xConfProvider = css::configuration::theDefaultProvider::get(comphelper::getProcessComponentContext()); - css::uno::Reference xFlushable(xConfProvider, css::uno::UNO_QUERY_THROW); - xFlushable->flush(); + std::shared_ptr xChanges(comphelper::ConfigurationChanges::create()); + officecfg::Office::Common::Misc::UseOpenCL::set(false, xChanges); + xChanges->commit(); - releaseOpenCLEnv(&openclwrapper::gpuEnv); - } + // Force synchronous config write + auto xConfProvider = css::configuration::theDefaultProvider::get(comphelper::getProcessComponentContext()); + css::uno::Reference xFlushable(xConfProvider, css::uno::UNO_QUERY_THROW); + xFlushable->flush(); + + releaseOpenCLEnv(&openclwrapper::gpuEnv); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */