summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2018-04-16 12:33:01 +0200
committerUlf Hermann <ulf.hermann@qt.io>2018-04-16 11:49:37 +0000
commit3ed8a60b09ebb423fe7d9391a2f59ff834d713ff (patch)
tree23993dda437c1d645a4659636ed54ad928697db8
parent2c52cab42d1b3070e26137299cbd9b0677af376c (diff)
Report an error if the device closes before we can read the header
Change-Id: I7792b12649c5e119fd88722b46b19aecd79b3bb7 Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
-rw-r--r--app/perfheader.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/perfheader.cpp b/app/perfheader.cpp
index 369b611..9987e3b 100644
--- a/app/perfheader.cpp
+++ b/app/perfheader.cpp
@@ -26,6 +26,7 @@ PerfHeader::PerfHeader(QIODevice *source) :
m_source(source), m_magic(0), m_size(0), m_attrSize(0)
{
connect(source, &QIODevice::readyRead, this, &PerfHeader::read);
+ connect(source, &QIODevice::aboutToClose, this, &PerfHeader::error);
for (uint i = 0; i < sizeof(m_features) / sizeof(quint64); ++i)
m_features[i] = 0;
}
@@ -116,6 +117,7 @@ void PerfHeader::read()
}
disconnect(m_source, &QIODevice::readyRead, this, &PerfHeader::read);
+ disconnect(m_source, &QIODevice::aboutToClose, this, &PerfHeader::error);
m_source = nullptr;
emit finished();
}