diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-03-15 08:02:57 +0200 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2013-03-15 08:02:57 +0200 |
commit | 3c4aad54083be752a1af7b9f686591cb758ed0f5 (patch) | |
tree | f260e26af823ff0b6b7e4b7bb2e8d41b854bf79f /src | |
parent | 43bfc75bc7d4f403683dc0a67785e08dfa11fd5d (diff) |
Crash fix
If client called setBarType before opengl was initialized, an assert occurred
Diffstat (limited to 'src')
-rw-r--r-- | src/datavis3d/engine/q3dbars.cpp | 10 | ||||
-rw-r--r-- | src/datavis3d/engine/q3dbars_p.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/datavis3d/engine/q3dbars.cpp b/src/datavis3d/engine/q3dbars.cpp index e338a43c..6e258343 100644 --- a/src/datavis3d/engine/q3dbars.cpp +++ b/src/datavis3d/engine/q3dbars.cpp @@ -127,6 +127,9 @@ void Q3DBars::initialize() // Set view port glViewport(0, 0, width(), height()); + + // Set initialized -flag + d_ptr->m_isInitialized = true; } void Q3DBars::render() @@ -628,8 +631,10 @@ void Q3DBars::setBarType(BarStyle style, bool smooth) d_ptr->m_objFile = QStringLiteral(":/defaultMeshes/cylinder"); } } - // Reload mesh data - d_ptr->loadBarMesh(); + if (d_ptr->m_isInitialized) { + // Reload mesh data + d_ptr->loadBarMesh(); + } } void Q3DBars::setMeshFileName(const QString &objFileName) @@ -740,6 +745,7 @@ Q3DBarsPrivate::Q3DBarsPrivate(Q3DBars *q) , m_heightColor(QColor(Qt::white)) , m_depthColor(QColor(Qt::darkGray)) , m_uniformColor(true) + , m_isInitialized(false) { } diff --git a/src/datavis3d/engine/q3dbars_p.h b/src/datavis3d/engine/q3dbars_p.h index c0fca68d..96af8216 100644 --- a/src/datavis3d/engine/q3dbars_p.h +++ b/src/datavis3d/engine/q3dbars_p.h @@ -109,6 +109,7 @@ public: QColor m_heightColor; QColor m_depthColor; bool m_uniformColor; + bool m_isInitialized; }; QTCOMMERCIALDATAVIS3D_END_NAMESPACE |