summaryrefslogtreecommitdiff
path: root/src/plugins/position/serialnmea/qiopipe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/position/serialnmea/qiopipe.cpp')
-rw-r--r--src/plugins/position/serialnmea/qiopipe.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/plugins/position/serialnmea/qiopipe.cpp b/src/plugins/position/serialnmea/qiopipe.cpp
index ce908d4d..fab0b56b 100644
--- a/src/plugins/position/serialnmea/qiopipe.cpp
+++ b/src/plugins/position/serialnmea/qiopipe.cpp
@@ -50,7 +50,15 @@ QT_BEGIN_NAMESPACE
QIOPipePrivate::QIOPipePrivate(QIODevice *iodevice, bool proxying)
: m_proxying(proxying), source(iodevice)
{
- const QIOPipe *parentPipe = qobject_cast<QIOPipe *>(iodevice);
+}
+
+QIOPipePrivate::~QIOPipePrivate()
+{
+}
+
+void QIOPipePrivate::initialize()
+{
+ const QIOPipe *parentPipe = qobject_cast<QIOPipe *>(source);
if (parentPipe && parentPipe->d_func()->m_proxying) // with proxying parent,
return; // don't do anything
@@ -60,10 +68,6 @@ QIOPipePrivate::QIOPipePrivate(QIODevice *iodevice, bool proxying)
QObjectPrivate::connect(source, &QIODevice::readyRead, this, &QIOPipePrivate::_q_onReadyRead);
}
-QIOPipePrivate::~QIOPipePrivate()
-{
-}
-
bool QIOPipePrivate::readAvailableData() {
if (!source)
return false;
@@ -130,6 +134,7 @@ void QIOPipePrivate::removeChildPipe(QIOPipe *childPipe)
QIOPipe::QIOPipe(QIODevice *parent, Mode mode)
: QIODevice(*new QIOPipePrivate(parent, mode == ProxyPipe), parent)
{
+ this->d_func()->initialize();
if (!parent->isOpen() && !parent->open(QIODevice::ReadOnly)) {
qWarning() << "QIOPipe: Failed to open " << parent;
return;