mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 18:32:50 +00:00
kreadconfig: keep references to QByteArray objects
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
04d7b0c309
commit
333aae94ed
2 changed files with 6 additions and 4 deletions
|
@ -88,7 +88,7 @@ int main(int argc, char **argv)
|
|||
KComponentData inst(&aboutData);
|
||||
KGlobal::config();
|
||||
|
||||
KConfig *konfig = nullptr;
|
||||
KConfig* konfig = nullptr;
|
||||
bool configMustDeleted = false;
|
||||
if (file.isEmpty()) {
|
||||
konfig = KGlobal::config().data();
|
||||
|
@ -118,14 +118,16 @@ int main(int argc, char **argv)
|
|||
}
|
||||
return retValue;
|
||||
} else if (type == QLatin1String("path")) {
|
||||
fprintf(stdout, "%s\n", cfgGroup.readPathEntry(key, dflt).toLocal8Bit().data());
|
||||
const QByteArray path = cfgGroup.readPathEntry(key, dflt).toLocal8Bit();
|
||||
fprintf(stdout, "%s\n", path.constData());
|
||||
if (configMustDeleted) {
|
||||
delete konfig;
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
/* Assume it's a string... */
|
||||
fprintf(stdout, "%s\n", cfgGroup.readEntry(key, dflt).toLocal8Bit().data());
|
||||
const QByteArray string = cfgGroup.readEntry(key, dflt).toLocal8Bit();
|
||||
fprintf(stdout, "%s\n", string.constData());
|
||||
if (configMustDeleted) {
|
||||
delete konfig;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ int main(int argc, char **argv)
|
|||
|
||||
KComponentData inst(&aboutData);
|
||||
|
||||
KConfig *konfig = nullptr;
|
||||
KConfig* konfig = nullptr;
|
||||
if (file.isEmpty()) {
|
||||
konfig = new KConfig(QString::fromLatin1("kdeglobals"), KConfig::NoGlobals);
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue