/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include #include #include #include #include #include #include #include namespace { css::uno::Reference instance; bool disposed = false; void doDispose( css::uno::Reference const & inst) { css::uno::Reference comp(inst, css::uno::UNO_QUERY); if (comp.is()) { SolarMutexReleaser r; comp->dispose(); } } } css::uno::Reference sw::proofreadingiterator::get( css::uno::Reference const & context) { css::uno::Reference inst( css::linguistic2::ProofreadingIterator::create(context)); bool disp; { SolarMutexGuard g; instance = inst; disp = disposed; } if (disp) { doDispose(inst); } return inst; } void sw::proofreadingiterator::dispose() { css::uno::Reference inst; { SolarMutexGuard g; inst = instance; instance.clear(); disposed = true; } doDispose(inst); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */