[patch] Two higher-level checks for invalid KProcess initialization
Jarosław Staniek
js at iidea.pl
Thu Dec 6 21:56:26 GMT 2007
Hello;
For review:
1. assertion for empty arg list in KProcess::setProgram(QStringList), where
the at least the 0th argument should be present -- this gives developers more
meaningful assetion than the current one at QList::takeFirst() level).
2. warning and failure is signalled within krun's runTempService() function
when no args are extracted for the process.
Index: kprocess.cpp
===================================================================
--- kprocess.cpp (revision 745715)
+++ kprocess.cpp (working copy)
@@ -213,6 +213,7 @@
{
Q_D(KProcess);
+ Q_ASSERT( !argv.isEmpty() );
d->args = argv;
d->prog = d->args.takeFirst();
}
Index: krun.cpp
===================================================================
--- krun.cpp (revision 745716)
+++ krun.cpp (working copy)
@@ -634,6 +634,11 @@
{
args = KRun::processDesktopExec(_service, _urls, tempFiles,
suggestedFileName );
}
+
+ if (args.isEmpty()) {
+ kWarning(7010) << "runTempService: KProcess no args!";
+ return false;
+ }
kDebug(7010) << "runTempService: KProcess args=" << args;
KProcess * proc = new KProcess;
--
regards / pozdrawiam, Jaroslaw Staniek
Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
Kexi & KOffice: http://www.kexi.pl/en, http://www.koffice.org
KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org
More information about the kde-core-devel
mailing list