-rw-r--r-- | library/qlibrary.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/qlibrary.cpp b/library/qlibrary.cpp index 4aabbc5..cbf49a3 100644 --- a/library/qlibrary.cpp +++ b/library/qlibrary.cpp | |||
@@ -1,100 +1,100 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | 21 | ||
22 | #include "qlibrary_p.h" | 22 | #include "qlibrary_p.h" |
23 | 23 | ||
24 | // uncomment this to get error messages | 24 | // uncomment this to get error messages |
25 | //#define QT_DEBUG_COMPONENT 1 | 25 | //#define QT_DEBUG_COMPONENT 1 |
26 | // uncomment this to get error and success messages | 26 | // uncomment this to get error and success messages |
27 | //#define QT_DEBUG_COMPONENT 2 | 27 | //#define QT_DEBUG_COMPONENT 2 |
28 | 28 | ||
29 | #ifndef QT_DEBUG_COMPONENT | 29 | #ifndef QT_DEBUG_COMPONENT |
30 | # if defined(QT_DEBUG) | 30 | # if defined(QT_DEBUG) |
31 | # define QT_DEBUG_COMPONENT 1 | 31 | # define QT_DEBUG_COMPONENT 1 |
32 | # endif | 32 | # endif |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #ifndef QT_NO_COMPONENT | 35 | #ifndef QT_NO_COMPONENT |
36 | 36 | ||
37 | // KAI C++ has at the moment problems with unloading the Qt plugins. So don't | 37 | // KAI C++ has at the moment problems with unloading the Qt plugins. So don't |
38 | // unload them as a workaround for now. | 38 | // unload them as a workaround for now. |
39 | #if defined(Q_CC_KAI) || defined(Q_OS_MAC) | 39 | #if defined(Q_CC_KAI) || defined(Q_OS_MAC) |
40 | #define QT_NO_LIBRARY_UNLOAD | 40 | #define QT_NO_LIBRARY_UNLOAD |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #if defined(Q_WS_WIN) && !defined(QT_MAKEDLL) | 43 | #if defined(Q_WS_WIN) && !defined(QT_MAKEDLL) |
44 | #define QT_NO_LIBRARY_UNLOAD | 44 | #define QT_NO_LIBRARY_UNLOAD |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | /* Platform independent QLibraryPrivate implementations */ | 47 | /* Platform independent QLibraryPrivate implementations */ |
48 | #ifndef QT_LITE_COMPONENT | 48 | #ifndef QT_LITE_COMPONENT |
49 | 49 | ||
50 | #include "qtimer.h" | 50 | #include "qtimer.h" |
51 | 51 | ||
52 | extern Q_EXPORT QApplication *qApp; | 52 | extern Q_EXPORT QApplication *qApp; |
53 | 53 | ||
54 | QLibraryPrivate::QLibraryPrivate( QLibrary *lib ) | 54 | QLibraryPrivate::QLibraryPrivate( QLibrary *lib ) |
55 | : QObject( 0, lib->library().latin1() ), pHnd( 0 ), libIface( 0 ), unloadTimer( 0 ), library( lib ) | 55 | : QObject( 0, lib->library().latin1() ), pHnd( 0 ), libIface( 0 ), unloadTimer( 0 ), library( lib ) |
56 | { | 56 | { |
57 | } | 57 | } |
58 | 58 | ||
59 | QLibraryPrivate::~QLibraryPrivate() | 59 | QLibraryPrivate::~QLibraryPrivate() |
60 | { | 60 | { |
61 | if ( libIface ) | 61 | if ( libIface ) |
62 | libIface->release(); | 62 | libIface->release(); |
63 | killTimer(); | 63 | killTimer(); |
64 | } | 64 | } |
65 | 65 | ||
66 | /* | 66 | /* |
67 | Only components that implement the QLibraryInterface can | 67 | Only components that implement the QLibraryInterface can |
68 | be unloaded automatically. | 68 | be unloaded automatically. |
69 | */ | 69 | */ |
70 | void QLibraryPrivate::tryUnload() | 70 | void QLibraryPrivate::tryUnload() |
71 | { | 71 | { |
72 | if ( library->policy() == QLibrary::Manual || !pHnd || !libIface ) | 72 | if ( library->policy() == QLibrary::Manual || !pHnd || !libIface ) |
73 | return; | 73 | return; |
74 | 74 | ||
75 | if ( !libIface->canUnload() ) | 75 | if ( !libIface->canUnload() ) |
76 | return; | 76 | return; |
77 | 77 | ||
78 | #if defined(QT_DEBUG_COMPONENT) && QT_DEBUG_COMPONENT == 2 | 78 | #if defined(QT_DEBUG_COMPONENT) && QT_DEBUG_COMPONENT == 2 |
79 | if ( library->unload() ) | 79 | if ( library->unload() ) |
80 | qDebug( "%s has been automatically unloaded", library->library().latin1() ); | 80 | qDebug( "%s has been automatically unloaded", library->library().latin1() ); |
81 | #else | 81 | #else |
82 | library->unload(); | 82 | library->unload(); |
83 | #endif | 83 | #endif |
84 | } | 84 | } |
85 | 85 | ||
86 | #else // QT_LITE_COMPOINENT | 86 | #else // QT_LITE_COMPOINENT |
87 | 87 | ||
88 | QLibraryPrivate::QLibraryPrivate( QLibrary *lib ) | 88 | QLibraryPrivate::QLibraryPrivate( QLibrary *lib ) |
89 | : pHnd( 0 ), libIface( 0 ), library( lib ) | 89 | : pHnd( 0 ), libIface( 0 ), library( lib ) |
90 | { | 90 | { |
91 | } | 91 | } |
92 | 92 | ||
93 | #endif // QT_LITE_COMPOINENT | 93 | #endif // QT_LITE_COMPOINENT |
94 | 94 | ||
95 | void QLibraryPrivate::startTimer() | 95 | void QLibraryPrivate::startTimer() |
96 | { | 96 | { |
97 | #ifndef QT_LITE_COMPONENT | 97 | #ifndef QT_LITE_COMPONENT |
98 | unloadTimer = new QTimer( this ); | 98 | unloadTimer = new QTimer( this ); |
99 | connect( unloadTimer, SIGNAL( timeout() ), this, SLOT( tryUnload() ) ); | 99 | connect( unloadTimer, SIGNAL( timeout() ), this, SLOT( tryUnload() ) ); |
100 | unloadTimer->start( 5000, FALSE ); | 100 | unloadTimer->start( 5000, FALSE ); |