diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2024-03-28 09:38:15 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-08-28 16:14:50 +0200 |
commit | df27f612240b32242799f3cd57607ce36eaf3162 (patch) | |
tree | 80e46f464b35357bbc5f9d67481440a9681b6816 /desktop/source | |
parent | e7e89eaf687310a31762ef5d325c22d7cc259a0b (diff) |
lok: add method to allow explicit cleanup of temporary files.o
Special case fast destruction of background saving children.
Change-Id: I8fba4d0818d23a8b0e1bb4d074e1afae7dacde33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165448
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 7d784910689172014b8cf6144e654402696d8801)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172520
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/lib/init.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index d7b7f9f3d429..5241fd4c1673 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1502,6 +1502,19 @@ LibLODocument_Impl::LibLODocument_Impl(uno::Reference <css::lang::XComponent> xC LibLODocument_Impl::~LibLODocument_Impl() { + if (comphelper::LibreOfficeKit::isForkedChild()) + { + // Touch the least memory possible, while trying to avoid leaking files. + SfxBaseModel* pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); + if (pBaseModel) + { + SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell(); + if (pObjectShell) + pObjectShell->InternalCloseAndRemoveFiles(); + } + return; + } + try { mxComponent->dispose(); |