summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormread <qt-info@nokia.com>2011-10-18 12:59:51 (GMT)
committermread <qt-info@nokia.com>2011-10-18 13:13:15 (GMT)
commitc9ae5814eb40acdb683004277573a09c6b78aba9 (patch)
tree4309bb4d3731c0a79fe89312e3c6646a49b54457
parentc838a413ee15b5ee872769f914f76ed3925b2201 (diff)
downloadQt-c9ae5814eb40acdb683004277573a09c6b78aba9.zip
Qt-c9ae5814eb40acdb683004277573a09c6b78aba9.tar.gz
Qt-c9ae5814eb40acdb683004277573a09c6b78aba9.tar.bz2
QS60StyleAnimation exception safety
QS60StyleAnimation had a number of exception safety problems. - Exceptions from QS60StyleAnimation/V2 could panic a TRAP harness. - Pointers could be uninitialised on exception in constructor. Problems solved by switching to QScopedPointer and simplifying the code. Task-number: QTBUG-4871 incidental finding Reviewed-by: Sami Merila
-rw-r--r--src/gui/styles/qs60style_p.h4
-rw-r--r--src/gui/styles/qs60style_s60.cpp10
2 files changed, 5 insertions, 9 deletions
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 2fa8c7f..ad55761 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -473,8 +473,8 @@ public:
private: //data members
//TODO: consider changing these to non-pointers as the classes are rather small anyway
- AnimationData *m_defaultData;
- AnimationDataV2 *m_currentData;
+ QScopedPointer<AnimationData> m_defaultData;
+ QScopedPointer<AnimationDataV2> m_currentData;
};
#endif //Q_WS_S60
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index cfb10fa..eb59115 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -132,14 +132,12 @@ AnimationDataV2::~AnimationDataV2()
QS60StyleAnimation::QS60StyleAnimation(const QS60StyleEnums::SkinParts part, int frames, int interval)
{
- QT_TRAP_THROWING(m_defaultData = new (ELeave) AnimationData(part, frames, interval));
- QT_TRAP_THROWING(m_currentData = new (ELeave) AnimationDataV2(*m_defaultData));
+ m_defaultData.reset(new AnimationData(part, frames, interval));
+ m_currentData.reset(new AnimationDataV2(*m_defaultData));
}
QS60StyleAnimation::~QS60StyleAnimation()
{
- delete m_currentData;
- delete m_defaultData;
}
void QS60StyleAnimation::setAnimationObject(CAknBitmapAnimation* animation)
@@ -152,9 +150,7 @@ void QS60StyleAnimation::setAnimationObject(CAknBitmapAnimation* animation)
void QS60StyleAnimation::resetToDefaults()
{
- delete m_currentData;
- m_currentData = 0;
- QT_TRAP_THROWING(m_currentData = new (ELeave) AnimationDataV2(*m_defaultData));
+ m_currentData.reset(new AnimationDataV2(*m_defaultData));
}
class QS60StyleModeSpecifics