1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <config_features.h>
22 #include <basic/sbstar.hxx>
23 #include <tools/debug.hxx>
25 #include <sfx2/app.hxx>
26 #include <appdata.hxx>
27 #include <sfx2/tbxctrl.hxx>
28 #include <sfx2/stbitem.hxx>
29 #include <sfx2/childwin.hxx>
30 #include <sfx2/dispatch.hxx>
31 #include <sfx2/msgpool.hxx>
32 #include <sfx2/fcontnr.hxx>
33 #include <nochaos.hxx>
34 #include <sfx2/doctempl.hxx>
35 #include <sfx2/viewfrm.hxx>
36 #include <sfx2/objsh.hxx>
37 #include <appbaslib.hxx>
38 #include <basic/basicmanagerrepository.hxx>
40 using ::basic::BasicManagerRepository
;
42 void SfxApplication::Deinitialize()
47 #if HAVE_FEATURE_SCRIPTING
50 SaveBasicAndDialogContainer();
53 pImpl
->bDowning
= true; // due to Timer from DecAliveCount and QueryExit
55 pImpl
->pTemplates
.reset();
57 // By definition there shouldn't be any open view frames when we reach
58 // this method. Therefore this call makes no sense and is the source of
59 // some stack traces, which we don't understand.
60 // For more information see:
61 pImpl
->bDowning
= false;
62 DBG_ASSERT(!SfxViewFrame::GetFirst(), "existing SfxViewFrame after Execute");
63 DBG_ASSERT(!SfxObjectShell::GetFirst(), "existing SfxObjectShell after Execute");
64 pImpl
->pAppDispat
->Pop(*this, SfxDispatcherPopFlags::POP_UNTIL
);
65 pImpl
->pAppDispat
->Flush();
66 pImpl
->bDowning
= true;
67 pImpl
->pAppDispat
->DoDeactivate_Impl(true, nullptr);
69 // Release Controller and others
70 // then the remaining components should also disappear ( Beamer! )
72 #if HAVE_FEATURE_SCRIPTING
73 BasicManagerRepository::resetApplicationBasicManager();
74 pImpl
->pBasicManager
->reset(nullptr); // this will also delete pBasMgr
77 DBG_ASSERT(pImpl
->pViewFrame
== nullptr, "active foreign ViewFrame");
79 // free administration managers
80 pImpl
->pAppDispat
.reset();
82 // from here no SvObjects have to exists
83 pImpl
->pMatcher
.reset();
85 pImpl
->pSlotPool
.reset();
86 pImpl
->maFactories
.clear();
88 pImpl
->maTbxCtrlFactories
.clear();
89 pImpl
->maStbCtrlFactories
.clear();
90 pImpl
->maViewFrames
.clear();
91 pImpl
->maViewShells
.clear();
92 pImpl
->maObjShells
.clear();
95 //ReleaseArgs could be used instead!
96 pImpl
->pPool
= nullptr;
97 NoChaos::ReleaseItemPool();
99 #if HAVE_FEATURE_SCRIPTING
100 pImpl
->m_pSbxErrorHdl
.reset();
102 pImpl
->m_pSoErrorHdl
.reset();
103 pImpl
->m_pToolsErrorHdl
.reset();
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */