Fix building under clang-7

Currently the build fails because of -Wdelete-non-virtual-dtor warnings.
This catches when an object is destructed, has a non-virtual destructor,
and is an abstract base class or a non-final class with virtual
functions. The warning happens inside unique_ptr<T>::~unique_ptr.

The warning is to prevent somebody writing code like this:

    class MySceneEndCondition : public CSceneEndCondition {
        ~MySceneEndCondition() { /* some complex logic */ }
    };
    // this won't call MySceneEndCondition's destructor, potentially
    // leading to leaks or segfaults:
    std::unique_ptr<CSceneEndCondition> p{new MySceneEndCondition()};
1008-fix
AbigailBuccaneer 2018-04-19 10:19:05 +01:00
parent 0391aaf773
commit 5cec29f4e6
2 changed files with 5 additions and 5 deletions

View File

@ -85,7 +85,7 @@ protected:
* \class CSceneEndCondition * \class CSceneEndCondition
* \brief Scene end condition * \brief Scene end condition
*/ */
class CSceneEndCondition : public CSceneCondition class CSceneEndCondition final : public CSceneCondition
{ {
public: public:
int winTeam = 0; int winTeam = 0;
@ -109,7 +109,7 @@ public:
* \class CAudioChangeCondition * \class CAudioChangeCondition
* \brief Audio change condition * \brief Audio change condition
*/ */
class CAudioChangeCondition : public CSceneCondition class CAudioChangeCondition final : public CSceneCondition
{ {
public: public:
std::string music = ""; std::string music = "";

View File

@ -78,7 +78,7 @@ public:
* \brief Scoreboard rule for destroying other objects * \brief Scoreboard rule for destroying other objects
* \see CScoreboard::AddKillRule() * \see CScoreboard::AddKillRule()
*/ */
class CScoreboardKillRule : public CScoreboardRule, public CObjectCondition class CScoreboardKillRule final : public CScoreboardRule, public CObjectCondition
{ {
public: public:
//! Read from line in scene file //! Read from line in scene file
@ -90,7 +90,7 @@ public:
* \brief Scoreboard rule for EndMissionTake rewards * \brief Scoreboard rule for EndMissionTake rewards
* \see CScoreboard::AddEndTakeRule() * \see CScoreboard::AddEndTakeRule()
*/ */
class CScoreboardEndTakeRule : public CScoreboardRule class CScoreboardEndTakeRule final : public CScoreboardRule
{ {
public: public:
int team = 0; int team = 0;