Ensure ProcessStdOutInput is always finalized

When canceling command the input is deleted. In that case
we should also finalize to prevent left open QIODevices.
parent c1379aca
...@@ -86,6 +86,11 @@ private: ...@@ -86,6 +86,11 @@ private:
class ProcessStdOutInput : public InputImplBase class ProcessStdOutInput : public InputImplBase
{ {
public: public:
~ProcessStdOutInput()
{
finalize();
}
explicit ProcessStdOutInput(const QString &cmd, const QStringList &args, const QDir &wd, const QByteArray &stdin_ = QByteArray()); explicit ProcessStdOutInput(const QString &cmd, const QStringList &args, const QDir &wd, const QByteArray &stdin_ = QByteArray());
std::shared_ptr<QIODevice> ioDevice() const override std::shared_ptr<QIODevice> ioDevice() const override
...@@ -447,6 +452,7 @@ void Input::finalize() ...@@ -447,6 +452,7 @@ void Input::finalize()
{ {
if (const std::shared_ptr<QIODevice> io = ioDevice()) if (const std::shared_ptr<QIODevice> io = ioDevice())
if (io->isOpen()) { if (io->isOpen()) {
qCDebug(KLEOPATRA_LOG) << "closing input";
io->close(); io->close();
} }
} }
Markdown is supported
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