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/stbitem.hxx>
28 #include <sfx2/tbxctrl.hxx>
29 #include <sfx2/childwin.hxx>
30 #include <sfx2/dispatch.hxx>
31 #include <nochaos.hxx>
32 #include <sfx2/viewfrm.hxx>
33 #include <sfx2/objsh.hxx>
34 #include <appbaslib.hxx>
35 #include <basic/basicmanagerrepository.hxx>
37 using ::basic::BasicManagerRepository
;
39 void SfxApplication::Deinitialize()
44 #if HAVE_FEATURE_SCRIPTING
47 SaveBasicAndDialogContainer();
50 pImpl
->bDowning
= true; // due to Timer from DecAliveCount and QueryExit
52 pImpl
->pTemplates
.reset();
54 // By definition there shouldn't be any open view frames when we reach
55 // this method. Therefore this call makes no sense and is the source of
56 // some stack traces, which we don't understand.
57 // For more information see:
58 pImpl
->bDowning
= false;
59 DBG_ASSERT(!SfxViewFrame::GetFirst(), "existing SfxViewFrame after Execute");
60 DBG_ASSERT(!SfxObjectShell::GetFirst(), "existing SfxObjectShell after Execute");
61 pImpl
->pAppDispat
->Pop(*this, SfxDispatcherPopFlags::POP_UNTIL
);
62 pImpl
->pAppDispat
->Flush();
63 pImpl
->bDowning
= true;
64 pImpl
->pAppDispat
->DoDeactivate_Impl(true, nullptr);
66 // Release Controller and others
67 // then the remaining components should also disappear ( Beamer! )
69 #if HAVE_FEATURE_SCRIPTING
70 BasicManagerRepository::resetApplicationBasicManager();
71 pImpl
->pBasicManager
->reset(nullptr); // this will also delete pBasMgr
74 DBG_ASSERT(pImpl
->pViewFrame
== nullptr, "active foreign ViewFrame");
76 // free administration managers
77 pImpl
->pAppDispat
.reset();
79 // from here no SvObjects have to exists
80 pImpl
->pMatcher
.reset();
82 pImpl
->pSlotPool
.reset();
83 pImpl
->maFactories
.clear();
85 pImpl
->maTbxCtrlFactories
.clear();
86 pImpl
->maStbCtrlFactories
.clear();
87 pImpl
->maViewFrames
.clear();
88 pImpl
->maViewShells
.clear();
89 pImpl
->maObjShells
.clear();
92 //ReleaseArgs could be used instead!
93 pImpl
->pPool
= nullptr;
94 NoChaos::ReleaseItemPool();
96 #if HAVE_FEATURE_SCRIPTING
97 pImpl
->m_pSbxErrorHdl
.reset();
99 pImpl
->m_pSoErrorHdl
.reset();
100 pImpl
->m_pToolsErrorHdl
.reset();
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */