/src/libreoffice/sfx2/source/appl/appquit.cxx
Line | Count | Source |
1 | | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | /* |
3 | | * This file is part of the LibreOffice project. |
4 | | * |
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/. |
8 | | * |
9 | | * This file incorporates work covered by the following license notice: |
10 | | * |
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 . |
18 | | */ |
19 | | |
20 | | #include <config_features.h> |
21 | | |
22 | | #include <basic/sbstar.hxx> |
23 | | #include <tools/debug.hxx> |
24 | | |
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> |
36 | | |
37 | | using ::basic::BasicManagerRepository; |
38 | | |
39 | | void SfxApplication::Deinitialize() |
40 | 0 | { |
41 | 0 | if (pImpl->bDowning) |
42 | 0 | return; |
43 | | |
44 | | #if HAVE_FEATURE_SCRIPTING |
45 | | StarBASIC::Stop(); |
46 | | |
47 | | SaveBasicAndDialogContainer(); |
48 | | #endif |
49 | | |
50 | 0 | pImpl->bDowning = true; // due to Timer from DecAliveCount and QueryExit |
51 | |
|
52 | 0 | pImpl->pTemplates.reset(); |
53 | | |
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 | 0 | pImpl->bDowning = false; |
59 | 0 | DBG_ASSERT(!SfxViewFrame::GetFirst(), "existing SfxViewFrame after Execute"); |
60 | 0 | DBG_ASSERT(!SfxObjectShell::GetFirst(), "existing SfxObjectShell after Execute"); |
61 | 0 | pImpl->pAppDispat->Pop(*this, SfxDispatcherPopFlags::POP_UNTIL); |
62 | 0 | pImpl->pAppDispat->Flush(); |
63 | 0 | pImpl->bDowning = true; |
64 | 0 | pImpl->pAppDispat->DoDeactivate_Impl(true, nullptr); |
65 | | |
66 | | // Release Controller and others |
67 | | // then the remaining components should also disappear ( Beamer! ) |
68 | |
|
69 | | #if HAVE_FEATURE_SCRIPTING |
70 | | BasicManagerRepository::resetApplicationBasicManager(); |
71 | | pImpl->pBasicManager->reset(nullptr); // this will also delete pBasMgr |
72 | | #endif |
73 | |
|
74 | 0 | DBG_ASSERT(pImpl->pViewFrame == nullptr, "active foreign ViewFrame"); |
75 | | |
76 | | // free administration managers |
77 | 0 | pImpl->pAppDispat.reset(); |
78 | | |
79 | | // from here no SvObjects have to exists |
80 | 0 | pImpl->pMatcher.reset(); |
81 | |
|
82 | 0 | pImpl->pSlotPool.reset(); |
83 | 0 | pImpl->maFactories.clear(); |
84 | |
|
85 | 0 | pImpl->maTbxCtrlFactories.clear(); |
86 | 0 | pImpl->maStbCtrlFactories.clear(); |
87 | 0 | pImpl->maViewFrames.clear(); |
88 | 0 | pImpl->maViewShells.clear(); |
89 | 0 | pImpl->maObjShells.clear(); |
90 | | |
91 | | //TODO/CLEANUP |
92 | | //ReleaseArgs could be used instead! |
93 | 0 | pImpl->pPool = nullptr; |
94 | 0 | NoChaos::ReleaseItemPool(); |
95 | |
|
96 | | #if HAVE_FEATURE_SCRIPTING |
97 | | pImpl->m_pSbxErrorHdl.reset(); |
98 | | #endif |
99 | 0 | pImpl->m_pSoErrorHdl.reset(); |
100 | 0 | pImpl->m_pToolsErrorHdl.reset(); |
101 | 0 | } |
102 | | |
103 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |