Changeset View
Changeset View
Standalone View
Standalone View
src/kbookmarkmanager.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
49 | #include "kbookmarkdialog.h" | 49 | #include "kbookmarkdialog.h" | ||
50 | #include "kbookmarkmanageradaptor_p.h" | 50 | #include "kbookmarkmanageradaptor_p.h" | ||
51 | 51 | | |||
52 | #define BOOKMARK_CHANGE_NOTIFY_INTERFACE "org.kde.KIO.KBookmarkManager" | 52 | #define BOOKMARK_CHANGE_NOTIFY_INTERFACE "org.kde.KIO.KBookmarkManager" | ||
53 | 53 | | |||
54 | class KBookmarkManagerList : public QList<KBookmarkManager *> | 54 | class KBookmarkManagerList : public QList<KBookmarkManager *> | ||
55 | { | 55 | { | ||
56 | public: | 56 | public: | ||
57 | KBookmarkManagerList(); | ||||
57 | ~KBookmarkManagerList() | 58 | ~KBookmarkManagerList() | ||
58 | { | 59 | { | ||
60 | cleanup(); | ||||
61 | } | ||||
62 | void cleanup() { | ||||
59 | QList<KBookmarkManager *> copy = *this; | 63 | QList<KBookmarkManager *> copy = *this; | ||
60 | qDeleteAll(copy); // auto-delete functionality | 64 | qDeleteAll(copy); // auto-delete functionality | ||
65 | clear(); | ||||
61 | } | 66 | } | ||
62 | 67 | | |||
63 | QReadWriteLock lock; | 68 | QReadWriteLock lock; | ||
64 | }; | 69 | }; | ||
65 | 70 | | |||
66 | Q_GLOBAL_STATIC(KBookmarkManagerList, s_pSelf) | 71 | Q_GLOBAL_STATIC(KBookmarkManagerList, s_pSelf) | ||
67 | 72 | | |||
73 | static void deleteManagers() { | ||||
74 | if (s_pSelf.exists()) { | ||||
75 | s_pSelf->cleanup(); | ||||
76 | } | ||||
77 | } | ||||
78 | | ||||
79 | KBookmarkManagerList::KBookmarkManagerList() | ||||
80 | { | ||||
81 | // Delete the KBookmarkManagers while qApp exists, since we interact with the DBus thread | ||||
82 | qAddPostRoutine(deleteManagers); | ||||
83 | } | ||||
84 | | ||||
68 | class KBookmarkMap : private KBookmarkGroupTraverser | 85 | class KBookmarkMap : private KBookmarkGroupTraverser | ||
69 | { | 86 | { | ||
70 | public: | 87 | public: | ||
71 | KBookmarkMap() : m_mapNeedsUpdate(true) {} | 88 | KBookmarkMap() : m_mapNeedsUpdate(true) {} | ||
72 | void setNeedsUpdate() | 89 | void setNeedsUpdate() | ||
73 | { | 90 | { | ||
74 | m_mapNeedsUpdate = true; | 91 | m_mapNeedsUpdate = true; | ||
75 | } | 92 | } | ||
▲ Show 20 Lines • Show All 637 Lines • Show Last 20 Lines |