Commit d35e1906 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

don't allocate m_process dynamically

parent 1c2f0f64
...@@ -82,7 +82,7 @@ private: ...@@ -82,7 +82,7 @@ private:
QWinEventNotifier *processFinishedNotifier; QWinEventNotifier *processFinishedNotifier;
#else #else
private: private:
QProcess *m_process; QProcess m_process;
private slots: private slots:
void processFinished(int, QProcess::ExitStatus); void processFinished(int, QProcess::ExitStatus);
#endif #endif
......
...@@ -35,7 +35,6 @@ ConsoleProcess::ConsoleProcess(QObject *parent) ...@@ -35,7 +35,6 @@ ConsoleProcess::ConsoleProcess(QObject *parent)
: QObject(parent) : QObject(parent)
{ {
m_isRunning = false; m_isRunning = false;
m_process = new QProcess(this);
} }
ConsoleProcess::~ConsoleProcess() ConsoleProcess::~ConsoleProcess()
...@@ -53,7 +52,7 @@ static QString shellEscape(const QString &in) ...@@ -53,7 +52,7 @@ static QString shellEscape(const QString &in)
bool ConsoleProcess::start(const QString &program, const QStringList &args) bool ConsoleProcess::start(const QString &program, const QStringList &args)
{ {
if (m_process->state() != QProcess::NotRunning) if (m_process.state() != QProcess::NotRunning)
return false; return false;
QString shellArgs; QString shellArgs;
shellArgs += QLatin1String("cd "); shellArgs += QLatin1String("cd ");
...@@ -66,13 +65,13 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args) ...@@ -66,13 +65,13 @@ bool ConsoleProcess::start(const QString &program, const QStringList &args)
} }
shellArgs += QLatin1String("; echo; echo \"Press enter to close this window\"; read DUMMY"); shellArgs += QLatin1String("; echo; echo \"Press enter to close this window\"; read DUMMY");
m_process->setEnvironment(environment()); m_process.setEnvironment(environment());
connect(m_process, SIGNAL(finished(int, QProcess::ExitStatus)), connect(&m_process, SIGNAL(finished(int, QProcess::ExitStatus)),
this, SLOT(processFinished(int, QProcess::ExitStatus))); this, SLOT(processFinished(int, QProcess::ExitStatus)));
m_process->start(QLatin1String("xterm"), QStringList() << QLatin1String("-e") << "/bin/sh" << "-c" << shellArgs); m_process.start(QLatin1String("xterm"), QStringList() << QLatin1String("-e") << "/bin/sh" << "-c" << shellArgs);
if (!m_process->waitForStarted()) if (!m_process.waitForStarted())
return false; return false;
emit processStarted(); emit processStarted();
return true; return true;
...@@ -85,22 +84,22 @@ void ConsoleProcess::processFinished(int, QProcess::ExitStatus) ...@@ -85,22 +84,22 @@ void ConsoleProcess::processFinished(int, QProcess::ExitStatus)
bool ConsoleProcess::isRunning() const bool ConsoleProcess::isRunning() const
{ {
return m_process->state() != QProcess::NotRunning; return m_process.state() != QProcess::NotRunning;
} }
void ConsoleProcess::stop() void ConsoleProcess::stop()
{ {
m_process->terminate(); m_process.terminate();
m_process->waitForFinished(); m_process.waitForFinished();
} }
qint64 ConsoleProcess::applicationPID() const qint64 ConsoleProcess::applicationPID() const
{ {
return m_process->pid(); return m_process.pid();
} }
int ConsoleProcess::exitCode() const int ConsoleProcess::exitCode() const
{ {
return m_process->exitCode(); return m_process.exitCode();
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment