aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2016-09-16 13:10:35 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-09-17 06:48:04 +0000
commit0342f3bb8a7a76c630f53e6e3073dfcf9162fec5 (patch)
tree4bb3c9bb51721b204674e1020ccbd597136213c6
parentbce02fde5844411c11d040f8e515cf7c0bf79059 (diff)
Fix duplicated QIviServiceInterface vtable/type_info
QIviServiceInterface was not exported and didn't have its dtor out-of-line, meaning every executable needing it would get its own copy of the vtable (and, thus, type_info object). Fix by exporting the class and making the dtor out-of-line. Fixes UBSan errors such as: tst_servicemanagertest.cpp:178:5: runtime error: member call on address 0x000001060890 which does not point to an object of type 'QIviServiceInterface' 0x000001060880: note: object is base class subobject at offset 16 within object of type 'QIviProxyServiceObject' 00 00 00 00 d0 6a ae d7 cd 2a 00 00 80 2b 06 01 00 00 00 00 58 6b ae d7 cd 2a 00 00 20 34 06 01 ^ ~~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QIviServiceInterface' base class of 'QIviProxyServiceObject' where QIviProxyServiceObject actually inherits QIviServiceInterface (indirectly, via QIviProxyServiceObject, in turn inheriting QObject (causing the offset mentioned in the error) and QIviServiceInterface). Change-Id: Ic63a27ada7b078436c9461064ffcf388614f9847 Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com>
-rw-r--r--src/ivicore/ivicore.pro1
-rw-r--r--src/ivicore/qiviserviceinterface.cpp50
-rw-r--r--src/ivicore/qiviserviceinterface.h8
3 files changed, 56 insertions, 3 deletions
diff --git a/src/ivicore/ivicore.pro b/src/ivicore/ivicore.pro
index d5e530e..a1b028b 100644
--- a/src/ivicore/ivicore.pro
+++ b/src/ivicore/ivicore.pro
@@ -34,6 +34,7 @@ HEADERS += \
SOURCES += \
qiviservicemanager.cpp \
+ qiviserviceinterface.cpp \
qiviserviceobject.cpp \
qiviabstractfeature.cpp \
qiviabstractzonedfeature.cpp \
diff --git a/src/ivicore/qiviserviceinterface.cpp b/src/ivicore/qiviserviceinterface.cpp
new file mode 100644
index 0000000..ba59693
--- /dev/null
+++ b/src/ivicore/qiviserviceinterface.cpp
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Pelagicore AG
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtIvi module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL-QTAS$
+** Commercial License Usage
+** Licensees holding valid commercial Qt Automotive Suite licenses may use
+** this file in accordance with the commercial license agreement provided
+** with the Software or, alternatively, in accordance with the terms
+** contained in a written agreement between you and The Qt Company. For
+** licensing terms and conditions see https://www.qt.io/terms-conditions.
+** For further information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: LGPL-3.0
+**
+****************************************************************************/
+
+#include "qiviserviceinterface.h"
+
+QT_BEGIN_NAMESPACE
+
+QIviServiceInterface::~QIviServiceInterface()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/ivicore/qiviserviceinterface.h b/src/ivicore/qiviserviceinterface.h
index 436b9ae..b26671c 100644
--- a/src/ivicore/qiviserviceinterface.h
+++ b/src/ivicore/qiviserviceinterface.h
@@ -42,14 +42,16 @@
#ifndef QIVISERVICEINTERFACE_H
#define QIVISERVICEINTERFACE_H
+#include <QtIviCore/qtiviglobal.h>
+
#include <QtCore/QtPlugin>
QT_BEGIN_NAMESPACE
-class QIviServiceInterface {
-
+class Q_QTIVICORE_EXPORT QIviServiceInterface
+{
public:
- virtual ~QIviServiceInterface() {}
+ virtual ~QIviServiceInterface();
virtual QStringList interfaces() const = 0;
virtual QObject* interfaceInstance(const QString& interface) const = 0;