author | zecke <zecke> | 2004-12-20 22:21:55 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-12-20 22:21:55 (UTC) |
commit | 2be4d5bf420dc4aff71cf78601c095a96ed88c47 (patch) (unidiff) | |
tree | f8d053d475501c2230a2c65acc1bed091d39faf9 /noncore/securityplugins/notice/noticeplugin.cpp | |
parent | b15930cd03acafd9770bca26f3388817f1a4dcbf (diff) | |
download | opie-2be4d5bf420dc4aff71cf78601c095a96ed88c47.zip opie-2be4d5bf420dc4aff71cf78601c095a96ed88c47.tar.gz opie-2be4d5bf420dc4aff71cf78601c095a96ed88c47.tar.bz2 |
Create the 'Config' instance on the Stack to avoid
that we revert changes done in between of our creation
and deletion
Diffstat (limited to 'noncore/securityplugins/notice/noticeplugin.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/securityplugins/notice/noticeplugin.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/noncore/securityplugins/notice/noticeplugin.cpp b/noncore/securityplugins/notice/noticeplugin.cpp index 5617855..d3dc7a4 100644 --- a/noncore/securityplugins/notice/noticeplugin.cpp +++ b/noncore/securityplugins/notice/noticeplugin.cpp | |||
@@ -10,14 +10,10 @@ using Opie::Security::MultiauthConfigWidget; | |||
10 | 10 | ||
11 | /// creates and initializes the m_config Config object | 11 | /// creates and initializes the m_config Config object |
12 | NoticePlugin::NoticePlugin() : MultiauthPluginObject(), m_noticeW(0) { | 12 | NoticePlugin::NoticePlugin() : MultiauthPluginObject(), m_noticeW(0) { |
13 | m_config = new Config("Security"); | ||
14 | m_config->setGroup("NoticePlugin"); | ||
15 | } | 13 | } |
16 | 14 | ||
17 | /// deletes the m_config Config object and noticeW if necessary | 15 | /// deletes the m_config Config object and noticeW if necessary |
18 | NoticePlugin::~NoticePlugin() { | 16 | NoticePlugin::~NoticePlugin() { |
19 | delete m_config; | ||
20 | if (m_noticeW != 0) | ||
21 | delete m_noticeW; | 17 | delete m_noticeW; |
22 | } | 18 | } |
23 | 19 | ||
@@ -81,6 +77,8 @@ int NoticePlugin::authenticate() { | |||
81 | */ | 77 | */ |
82 | QString NoticePlugin::getNoticeText() { | 78 | QString NoticePlugin::getNoticeText() { |
83 | // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp | 79 | // Note: C++ processes '\' character, so we have to type \\\\ to mean \\ to QRegExp |
84 | return m_config->readEntry("noticeText", QObject::tr(defaultNoticeText)).replace( QRegExp("\\\\n"), "\n" ); | 80 | Config config("Security"); |
81 | config.setGroup("NoticePlugin"); | ||
82 | return config.readEntry("noticeText", QObject::tr(defaultNoticeText)).replace( QRegExp("\\\\n"), "\n" ); | ||
85 | } | 83 | } |
86 | 84 | ||