IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage C++ Discussion :

Crash lors de la construction de mon BSP-TREE.


Sujet :

Langage C++

  1. #1
    Invité
    Invité(e)
    Par défaut Crash lors de la construction de mon BSP-TREE.
    Salut, j'essaye de faire un BSP-TREE afin de combiner plusieurs actions entre elle. (chaque action est liée à un type d'événement)

    Voici le fichier .h :

    Code cpp : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
     
    #ifndef ODFAEG_ACTION_HPP
    #define ODFAEG_ACTION_HPP
    #include "export.hpp"
    #include <map>
    #include "signal.h"
    #include <SFML/Graphics.hpp>
    #include <functional>
    #include <memory>
    #include <iostream>
    /**
      *\namespace odfaeg
      * the namespace of the Opensource Development Framework Adapted for Every Games.
      */
    namespace odfaeg {
    /**
      * \file action.h
      * \class Action
      * \brief Link SFML events to odfaeg actions.
      * \author Duroisin.L
      * \version 1.0
      * \date 1/02/2014
      * Link one or more SFML Events to ACTIONS, and determine when the action is triggered.
      * The sf::Events are stored into the leafs of a BSP tree structure.
      * It means that combined actions contains two children :
        -The first action child is linked to the first SFML event.
        -The second action child is linked to the second SFML event.
        -The combined actions contains also a pointer to a function who determine when the combined action is triggered.
        by exemple the xor function return true if one of the two action's children is triggered. (not both)
      */
    class ActionMap;
    class ODFAEG_CORE_API Action {
        public :
        /** \enum EVENT_TYPE
        *   \brief the types of the events witch are linked to actions.
        *   COMBINED_WITH_OR, COMBINED_WITH_X_OR AND COMBINED_WITH_AND define a combination of actions.
        *   the action is triggered if one or/and the passed sf:Events are triggered.
        *   by exemple if CLOSED is passed, an sf::Event of type Closed is stored.
        */
        enum EVENT_TYPE {
            KEY_PRESSED_ONCE, KEY_HELD_DOWN, KEY_RELEASED,
            MOUSE_BUTTON_PRESSED_ONCE, MOUSE_BUTTON_HELD_DOWN, MOUSE_BUTTON_RELEASED,
            JOYSTICK_BUTTON_PRESSED_ONCE, JOYSTICK_BUTTON_HELD_DOWN, JOYSTICK_BUTTON_RELEASED,
            CLOSED, RESIZED, LOST_FOCUS, GAIGNED_FOCUS, TEXT_ENTERED, MOUSE_WHEEL_MOVED,
            MOUSE_MOVED, MOUSE_ENTERED, MOUSE_LEFT, JOYSTICK_MOVED, JOYSTICK_CONNECTED, JOYSTICK_DISCONNECTED,
            COMBINED_WITH_OR, COMBINED_WITH_XOR, COMBINED_WITH_AND
        };
        /**\fn Action (EVENT_TYPE)
        * \brief constructor (define an action with an event type)
        * \param an enum that is related to the sfml event type who's linked to the action.
        */
        Action (EVENT_TYPE type);
        /**\fn Action (EVENT_TYPE type, sf::Keyboard key)
        *  \brief constructor (define an action with a key event)
        *  \param type : the type of the event. (KEY_PRESSED_ONCE, KEY_HELD_DOWN or KEY_RELEASED, other types are invalid)
        *  \param key : the key of the keyevent.
        */
        Action (EVENT_TYPE type, sf::Keyboard::Key key);
        /**\fn Action (EVENT_TYPE type, sf::Mouse::Button button)
        *  \brief constructor (define an action with a mouse event)
        *  \param type : the type of the event. (MOUSE_BUTTON_PRESSED_ONCE, MOUSE_BUTTON_HELD_DOWN or MOUSE_BUTTON_RELEASED, other types are invalid)
        *  \param button : the button of the mouseevent.
        */
        Action (EVENT_TYPE type, sf::Mouse::Button button);
        /**\fn bool andComparator (Action *a1, Action *a2)
        *  \brief check if two actions are triggered.
        *  \param a1 : the first action. (the left child)
        *  \param a2 : the second action. (the right child)
        *  \return true if the two actions are triggered.
        */
        Action(const Action& other);
        bool andComparator (std::unique_ptr<Action>&, std::unique_ptr<Action>&);
        /**\fn bool orComparator (Action *a1, Action *a2)
        *  \brief check if one action (ot both) is/are triggered.
        *  \param a1 : the first action. (the left child)
        *  \param a2 : the second action. (the right child)
        *  \return true if one action o both are triggered.
        */
        bool orComparator (std::unique_ptr<Action>&, std::unique_ptr<Action>&);
        /**\fn bool xorComparator (Action *a1, Action *a2)
        *  \brief check if one action is triggered. (only one, not both)
        *  \param a1 : the first action. (the left child)
        *  \param a2 : the second action. (the right child)
        *  \return true if one of the two actions is triggered. (Not both)
        */
        bool xorComparator (std::unique_ptr<Action>&, std::unique_ptr<Action>&);
        /**\fn void operator!()
        *  \brief redefines the not operator, the function isTriggered return true if the action is NOT triggered.
        */
        void operator! ();
        /**\fn Action& operator| (Action &other)
        *  \brief redefines the operator| (xor) to build a combined action.
        *  \param the other action.
        *  \return the combined action.
        */
        Action& operator| (Action &other);
        /**\fn Action& operator|| (Action &other)
        *  \brief redefines the operator|| (or) to build a combined action.
        *  \param the other action.
        *  \return the combined action.
        */
        Action& operator|| (Action &other);
        /**\fn Action& operator&& (Action &other)
        *  \brief redefines the operator&& (and) to build a combined action.
        *  \param the other action.
        *  \return the combined action.
        */
        Action& operator&& (Action &other);
        /**\fn bool containsEvent ();
        *  \brief return true if the action contains the passed event.
        *  \param sf::Event& the passed event.
        *  \return true if the action is triggered, false otherwise.
        */
        bool containsEvent (sf::Event& event);
        /**\fn bool isTriggered ();
        *  \brief return true if the action is triggered, the triggered sf::Events are stored into the
        * ActionMap class, the sf::Events are passed to this function and if an sf:Event is contained in
        * a leaf action, the sf::event is evaluated with this one.
        *  \return true if the action is triggered, false otherwise.
        */
        bool isTriggered ();
        /**\fn Action (EVENT_TYPE, Action *lefChild, Action *rightChild)
        *  \brief build a combined action. (This constructor is used by the redefinition of the logical operators)
        *  \param type : the type of the combined action. (COMBINED_WITH_AND, COMBINED_WITH_OR or COMBINED_WITH_XOR)
        *  \param leftChild : the left child.
        *  \param rightChild : the right child.
        */
        Action (EVENT_TYPE type, Action& leftChild, Action& rightChild);
        /**\fn setPressed (sf::Event event, bool pressed)
        *  \brief reset the states of the event. (For key pressed events and mouse button pressed envents types only)
        *  this function is necessary to avoid that PRESSED_ONCE action's types occurs more than once while the key or a button is held down.
        *  \param sf::Event : the event onwich we want to reset the state.
        **/
        void setPressed (sf::Event event, bool pressed);
        /**\fn void getEvents(std::vector<sf::Event>& events);
        *  \param the list of all sf::Events contained into the BSP-tree.
        */
        void getEvents(std::vector<sf::Event>& events);
        Action& operator=(const Action& action);
        private :
        /**\fn bool equalEvent (sf::Event event, sf::Event other)
        *  \brief compare two sf::Events. (The events are equal if the event's types and params are equal)
        *  \return true if the two sf::Event are equal, false otherwise.
        */
        bool equalEvent (sf::Event event, sf::Event other);
        bool pressed; /**< the state of the event contained into the BSP tree*/
        EVENT_TYPE type; /**< the type of the event.*/
        sf::Event startEvent; /**< the sf::event linked to the action. (for single actions only)*/
        bool leaf; /**< determine if the action is a single or a combined action*/
        std::unique_ptr<Action> leftChild;
        std::unique_ptr<Action> rightChild;/**<pointers to the two action's children if the action is a combined action*/
        std::function<bool(std::unique_ptr<Action>&, std::unique_ptr<Action>&)> comparator;/**A pointer to the function which's used to compare two actions. (For combined actions only)*/
        bool is_not; /**<determine if the isTriggered function have to return true or false if the action is triggered*/
    };
     
    }
    #endif // ACTION

    Et voici le fichier .cpp de la classe.

    Code cpp : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
     
    #include "../../../include/odfaeg/Core/action.h"
    #include "../../../include/odfaeg/Core/actionMap.h"
    using namespace std;
    namespace odfaeg {
    Action::Action (EVENT_TYPE type) : type(type) {
        leaf = true;
        pressed = false;
        switch (type) {
            case CLOSED :
                startEvent.type = sf::Event::Closed;
                break;
            case RESIZED :
                startEvent.type = sf::Event::Resized;
                break;
            case LOST_FOCUS :
                startEvent.type = sf::Event::LostFocus;
                break;
            case GAIGNED_FOCUS :
                startEvent.type = sf::Event::GainedFocus;
                break;
            case TEXT_ENTERED :
                startEvent.type = sf::Event::TextEntered;
                break;
            case MOUSE_WHEEL_MOVED :
                startEvent.type = sf::Event::MouseWheelMoved;
                break;
            case MOUSE_MOVED :
                startEvent.type = sf::Event::MouseMoved;
                break;
            case MOUSE_ENTERED :
                startEvent.type = sf::Event::MouseEntered;
                break;
            case MOUSE_LEFT :
                startEvent.type = sf::Event::MouseEntered;
                break;
            case JOYSTICK_MOVED :
                startEvent.type = sf::Event::MouseLeft;
                break;
            case JOYSTICK_CONNECTED :
                startEvent.type = sf::Event::JoystickConnected;
                break;
            case JOYSTICK_DISCONNECTED :
                startEvent.type = sf::Event::JoystickDisconnected;
                break;
        }
        is_not = false;
    }
    Action::Action (EVENT_TYPE type, sf::Keyboard::Key key) : type(type) {
        leaf = true;
        pressed = false;
        switch (type) {
        case KEY_PRESSED_ONCE :
            startEvent.type = sf::Event::KeyPressed;
            startEvent.key.code = key;
            break;
        case KEY_HELD_DOWN :
            startEvent.type = sf::Event::KeyPressed;
            startEvent.key.code = key;
            break;
        case KEY_RELEASED :
            startEvent.type = sf::Event::KeyReleased;
            startEvent.key.code = key;
            break;
        }
        is_not = false;
    }
    Action::Action (EVENT_TYPE type, sf::Mouse::Button button) : type(type) {
        leaf = true;
        pressed = false;
        switch (type) {
            case MOUSE_BUTTON_PRESSED_ONCE :
                startEvent.type = sf::Event::MouseButtonPressed;
                startEvent.mouseButton.button = button;
                break;
            case MOUSE_BUTTON_HELD_DOWN :
                startEvent.type = sf::Event::MouseButtonPressed;
                startEvent.mouseButton.button = button;
                break;
            case MOUSE_BUTTON_RELEASED :
                startEvent.type = sf::Event::MouseButtonReleased;
                startEvent.mouseButton.button = button;
                break;
        }
        is_not = false;
    }
    Action::Action(const Action& other) {
        leaf = other.leaf;
        pressed = other.pressed;
        startEvent = other.startEvent;
        is_not = other.is_not;
        leftChild = std::make_unique<Action>(*(other.leftChild));
        rightChild = std::make_unique<Action>(*(other.rightChild));
        comparator = other.comparator;
        pressed = other.pressed;
        type = other.type;
    }
    /*Action (EVENT_TYPE type, sf::Joystick::Button button) : type(type) {
        cptype = NONE;
        switch (type) {
            case JOYSTICK_BUTTON_PRESSED_ONCE :
                startEvent.type = sf::Event::MouseButtonPressed;
                startEvent.joystickButton.button = button;
                break;
            case JOYSTICK_BUTTON_HELD_DOWN :
                startEvent.joystickButton.button = button;
                break;
            case JOYSTICK_BUTTON_RELEASED :
                startEvent.type = sf::Event::MouseButtonReleased;
                startEvent.joystickButton.button = button;
                break;
        }
    }*/
    bool Action::andComparator (std::unique_ptr<Action>& a1, std::unique_ptr<Action>& a2) {
        return a1->isTriggered() && a2->isTriggered();
    }
    bool Action::orComparator (std::unique_ptr<Action>& a1, std::unique_ptr<Action>& a2) {
        return a1->isTriggered() || a2->isTriggered();
    }
    bool Action::xorComparator (std::unique_ptr<Action>& a1, std::unique_ptr<Action>& a2) {
        return a1->isTriggered() | a2->isTriggered();
    }
    void Action::operator! () {
        if (!is_not)
            is_not = true;
        else
            is_not = false;
    }
    Action& Action::operator| (Action &other) {
        std::unique_ptr<Action> result = std::make_unique<Action>(COMBINED_WITH_XOR, *this, other);
        return *result;
    }
    Action& Action::operator|| (Action &other) {
        std::unique_ptr<Action> result = std::make_unique<Action>(COMBINED_WITH_XOR, *this, other);
        return *result;
    }
    Action& Action::operator&& (Action &other) {
        std::unique_ptr<Action> result = std::make_unique<Action>(COMBINED_WITH_XOR, *this, other);
        return *result;
    }
    bool Action::isTriggered () {
        vector<sf::Event> events = Command::getEvents();
        if (leaf) {
            if (type == KEY_HELD_DOWN && !is_not) {
                return sf::Keyboard::isKeyPressed(startEvent.key.code);
            }
            if (type == KEY_HELD_DOWN && is_not) {
                return !sf::Keyboard::isKeyPressed(startEvent.key.code);
            }
            if (type == MOUSE_BUTTON_HELD_DOWN && !is_not) {
                return sf::Mouse::isButtonPressed(startEvent.mouseButton.button);
            }
            if (type == MOUSE_BUTTON_HELD_DOWN && is_not) {
                return !sf::Mouse::isButtonPressed(startEvent.mouseButton.button);
            }
            /*else if (type == JOYSTICK_BUTTON_HELD_DOWN)
                return sf::Joystick::isButtonPressed(startEvent.joystickButton.button);*/
            for (unsigned int i = 0; i < events.size(); i++) {
                if (!is_not && !pressed) {
                    return equalEvent(events[i], startEvent);
                } else if (is_not) {
                    return !equalEvent(events[i], startEvent);
                } else {
                    return false;
                }
            }
     
     
        } else {
            return comparator(std::ref(this->leftChild), std::ref(this->rightChild));
        }
    }
    Action::Action (EVENT_TYPE type, Action& leftChild, Action& rightChild)  {
        leaf = false;
        this->type = type;
        this->leftChild = std::make_unique<Action>(leftChild);
        this->rightChild = std::make_unique<Action>(rightChild);
        is_not = false;
        pressed = false;
        if (type == COMBINED_WITH_AND) {
            comparator = std::bind(&Action::andComparator, this, std::ref(this->leftChild), std::ref(this->rightChild));
        } else if (type == COMBINED_WITH_OR) {
            comparator = std::bind(&Action::orComparator, this, std::ref(this->leftChild), std::ref(this->rightChild));
        } else {
            comparator = std::bind(&Action::xorComparator, this, std::ref(this->leftChild), std::ref(this->rightChild));
        }
    }
     
    bool Action::equalEvent (sf::Event event, sf::Event other) {
        if (event.type != other.type)
            return false;
        if (event.type == sf::Event::Resized) {
            return event.size.width == other.size.width && event.size.height == other.size.height;
        }
        if (event.type == sf::Event::TextEntered) {
            return event.text.unicode == other.text.unicode;
        }
        if (event.type == sf::Event::KeyPressed || event.type == sf::Event::KeyReleased) {
            if (event.type == sf::Event::KeyPressed && event.key.code == other.key.code)
                pressed = true;
            return event.key.code == other.key.code;
        }
        if (event.type == sf::Event::MouseWheelMoved) {
            return event.mouseWheel.delta == other.mouseWheel.delta;
        }
        if (event.type == sf::Event::MouseButtonPressed || event.type == sf::Event::MouseButtonReleased) {
            if (event.type == sf::Event::MouseButtonPressed && event.mouseButton.button == other.mouseButton.button)
                pressed = true;
            return event.mouseButton.button == other.mouseButton.button;
        }
        if (event.type == sf::Event::MouseMoved) {
            return event.mouseMove.x == other.mouseMove.x && event.mouseMove.y == other.mouseMove.y;
        }
        if (event.type == sf::Event::JoystickButtonPressed || event.type == sf::Event::JoystickButtonReleased) {
            return event.joystickButton.joystickId == other.joystickButton.joystickId
                && event.joystickButton.button == other.joystickButton.button;
        }
        if (event.type == sf::Event::JoystickMoved) {
            return event.joystickMove.joystickId == other.joystickMove.joystickId
                && event.joystickMove.position == other.joystickMove.position;
        }
        return false;
    }
    void Action::setPressed(sf::Event event, bool pressed) {
        if (!leaf) {
            leftChild->setPressed(event, pressed);
            rightChild->setPressed(event, pressed);
        } else {
            if ((event.type == sf::Event::KeyReleased && startEvent.type == sf::Event::KeyPressed && event.key.code == startEvent.key.code) ||
                (event.type == sf::Event::MouseButtonReleased && startEvent.type == sf::Event::MouseButtonPressed && event.mouseButton.button == startEvent.mouseButton.button)) {
                this->pressed = pressed;
            }
        }
    }
    bool Action::containsEvent(sf::Event& event) {
        if (!leaf) {
            return leftChild->containsEvent(event) || rightChild->containsEvent(event);
        } else {
            return Command::equalEvent(event, startEvent);
        }
    }
    void Action::getEvents(std::vector<sf::Event>& events) {
        if (!leaf) {
            leftChild->getEvents(events);
            rightChild->getEvents(events);
        } else {
            events.push_back(startEvent);
        }
    }
    Action& Action::operator=(const Action& other) {
        leaf = other.leaf;
        pressed = other.pressed;
        startEvent = other.startEvent;
        is_not = other.is_not;
        leftChild = std::make_unique<Action>(*(other.leftChild));
        rightChild = std::make_unique<Action>(*(other.rightChild));
        comparator = other.comparator;
        pressed = other.pressed;
        type = other.type;
        return *this;
    }
    }

    Le problème surviens lors de la création du BSP-TREE dans le main, j'ai un crash à la dernière ligne :

    Code cpp : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    int main (int argv, char* argc[]) {
        odfaeg::Action a1 (odfaeg::Action::EVENT_TYPE::KEY_HELD_DOWN, sf::Keyboard::Key::Z);
        odfaeg::Action a2 (odfaeg::Action::EVENT_TYPE::KEY_HELD_DOWN, sf::Keyboard::Key::Q);
        odfaeg::Action a3 (odfaeg::Action::EVENT_TYPE::KEY_HELD_DOWN, sf::Keyboard::Key::S);
        odfaeg::Action a4 (odfaeg::Action::EVENT_TYPE::KEY_HELD_DOWN, sf::Keyboard::Key::D);
        odfaeg::Action a5 (odfaeg::Action::EVENT_TYPE::MOUSE_BUTTON_PRESSED_ONCE, sf::Mouse::Left);
        odfaeg::Action combined  = a1 || a2 || a3 || a4;  
    }

    Voici ce que me donne valgrind :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
     
    # valgrind -v ./ODFAEG-DEMO
    ==17490== Memcheck, a memory error detector
    ==17490== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
    ==17490== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
    ==17490== Command: ./ODFAEG-DEMO
    ==17490== 
    --17490-- Valgrind options:
    --17490--    -v
    --17490-- Contents of /proc/version:
    --17490--   Linux version 3.13.0-35-generic (buildd@panlong) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #62-Ubuntu SMP Fri Aug 15 01:58:42 UTC 2014
    --17490-- Arch and hwcaps: AMD64, amd64-cx16-rdtscp-sse3
    --17490-- Page sizes: currently 4096, max supported 4096
    --17490-- Valgrind library directory: /usr/lib/valgrind
    --17490-- Reading syms from /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO
    --17490-- Reading syms from /lib/x86_64-linux-gnu/ld-2.19.so
    --17490--   Considering /lib/x86_64-linux-gnu/ld-2.19.so ..
    --17490--   .. CRC mismatch (computed 4cbae35e wanted 8d683c31)
    --17490--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/ld-2.19.so ..
    --17490--   .. CRC is valid
    --17490-- Reading syms from /usr/lib/valgrind/memcheck-amd64-linux
    --17490--   Considering /usr/lib/valgrind/memcheck-amd64-linux ..
    --17490--   .. CRC mismatch (computed 37cdde19 wanted adc367dd)
    --17490--    object doesn't have a symbol table
    --17490--    object doesn't have a dynamic symbol table
    --17490-- Scheduler: using generic scheduler lock implementation.
    --17490-- Reading suppressions file: /usr/lib/valgrind/default.supp
    ==17490== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-17490-by-root-on-???
    ==17490== embedded gdbserver: writing to   /tmp/vgdb-pipe-to-vgdb-from-17490-by-root-on-???
    ==17490== embedded gdbserver: shared mem   /tmp/vgdb-pipe-shared-mem-vgdb-17490-by-root-on-???
    ==17490== 
    ==17490== TO CONTROL THIS PROCESS USING vgdb (which you probably
    ==17490== don't want to do, unless you know exactly what you're doing,
    ==17490== or are doing some strange experiment):
    ==17490==   /usr/lib/valgrind/../../bin/vgdb --pid=17490 ...command...
    ==17490== 
    ==17490== TO DEBUG THIS PROCESS USING GDB: start GDB like this
    ==17490==   /path/to/gdb ./ODFAEG-DEMO
    ==17490== and then give GDB the following command
    ==17490==   target remote | /usr/lib/valgrind/../../bin/vgdb --pid=17490
    ==17490== --pid is optional if only one valgrind process is running
    ==17490== 
    --17490-- REDIR: 0x4019ca0 (strlen) redirected to 0x38068331 (???)
    --17490-- Reading syms from /usr/lib/valgrind/vgpreload_core-amd64-linux.so
    --17490--   Considering /usr/lib/valgrind/vgpreload_core-amd64-linux.so ..
    --17490--   .. CRC mismatch (computed 329d6860 wanted c0186920)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so
    --17490--   Considering /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so ..
    --17490--   .. CRC mismatch (computed 1fb85af8 wanted 2e9e3c16)
    --17490--    object doesn't have a symbol table
    ==17490== WARNING: new redirection conflicts with existing -- ignoring it
    --17490--     old: 0x04019ca0 (strlen              ) R-> (0000.0) 0x38068331 ???
    --17490--     new: 0x04019ca0 (strlen              ) R-> (2007.0) 0x04c2e1a0 strlen
    --17490-- REDIR: 0x4019a50 (index) redirected to 0x4c2dd50 (index)
    --17490-- REDIR: 0x4019c70 (strcmp) redirected to 0x4c2f2f0 (strcmp)
    --17490-- REDIR: 0x401a9c0 (mempcpy) redirected to 0x4c31da0 (mempcpy)
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libsfml-graphics.so.2.1
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libsfml-window.so.2.1
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libsfml-system.so.2.1
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 ..
    --17490--   .. CRC mismatch (computed 17c7ca1e wanted 14885900)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20 ..
    --17490--   .. CRC mismatch (computed 08deb6f3 wanted 62c39e47)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libm-2.19.so
    --17490--   Considering /lib/x86_64-linux-gnu/libm-2.19.so ..
    --17490--   .. CRC mismatch (computed 0ebccb69 wanted 44d41128)
    --17490--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libm-2.19.so ..
    --17490--   .. CRC is valid
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libgcc_s.so.1
    --17490--   Considering /lib/x86_64-linux-gnu/libgcc_s.so.1 ..
    --17490--   .. CRC mismatch (computed 5deec489 wanted b8412602)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libc-2.19.so
    --17490--   Considering /lib/x86_64-linux-gnu/libc-2.19.so ..
    --17490--   .. CRC mismatch (computed e7228afa wanted 93ff6981)
    --17490--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so ..
    --17490--   .. CRC is valid
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libfreetype.so.6.11.1
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libGLEW.so.1.10.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libjpeg.so.8.0.2
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0 ..
    --17490--   .. CRC mismatch (computed c168660b wanted 161bd255)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libXrandr.so.2.2.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libXrandr.so.2.2.0 ..
    --17490--   .. CRC mismatch (computed 0be820e9 wanted c977080b)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libpthread-2.19.so
    --17490--   Considering /lib/x86_64-linux-gnu/libpthread-2.19.so ..
    --17490--   .. CRC mismatch (computed d7f7b713 wanted 28afece6)
    --17490--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libpthread-2.19.so ..
    --17490--   .. CRC is valid
    --17490-- Reading syms from /lib/x86_64-linux-gnu/librt-2.19.so
    --17490--   Considering /lib/x86_64-linux-gnu/librt-2.19.so ..
    --17490--   .. CRC mismatch (computed aa86d720 wanted d04e3800)
    --17490--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/librt-2.19.so ..
    --17490--   .. CRC is valid
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libglapi.so.0.0.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libglapi.so.0.0.0 ..
    --17490--   .. CRC mismatch (computed 0eb4f325 wanted 30b7ee48)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0 ..
    --17490--   .. CRC mismatch (computed 02fd320d wanted 0899221f)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libXdamage.so.1.1.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libXdamage.so.1.1.0 ..
    --17490--   .. CRC mismatch (computed fe4e32c0 wanted 2a5b3a13)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libXfixes.so.3.1.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1.0.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1.0.0 ..
    --17490--   .. CRC mismatch (computed e2f4c069 wanted 2164c257)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0.0.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0.0.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0.0.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libxcb-present.so.0.0.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1.0.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libxshmfence.so.1.0.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1.0.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libdrm.so.2.4.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libdl-2.19.so
    --17490--   Considering /lib/x86_64-linux-gnu/libdl-2.19.so ..
    --17490--   .. CRC mismatch (computed c1315e8c wanted 37097b60)
    --17490--   Considering /usr/lib/debug/lib/x86_64-linux-gnu/libdl-2.19.so ..
    --17490--   .. CRC is valid
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libz.so.1.2.8
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libpng12.so.0.50.0
    --17490--   Considering /lib/x86_64-linux-gnu/libpng12.so.0.50.0 ..
    --17490--   .. CRC mismatch (computed bcf7bdd8 wanted dafabe67)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libXrender.so.1.3.0 ..
    --17490--   .. CRC mismatch (computed 96d07840 wanted d3cfc2cf)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libXau.so.6.0.0 ..
    --17490--   .. CRC mismatch (computed 256f5df8 wanted 5d40ac88)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libXdmcp.so.6.0.0 ..
    --17490--   .. CRC mismatch (computed 15fc4130 wanted a06cb5c7)
    --17490--    object doesn't have a symbol table
    --17490-- REDIR: 0x5fa17e0 (strcasecmp) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5fa3ad0 (strncasecmp) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5fa0fb0 (memcpy@GLIBC_2.2.5) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5f9f240 (rindex) redirected to 0x4c2da30 (rindex)
    --17490-- REDIR: 0x5f9d540 (strlen) redirected to 0x4c2e0e0 (strlen)
    --17490-- REDIR: 0x5fa0a20 (__GI_memcmp) redirected to 0x4c30b80 (__GI_memcmp)
    --17490-- REDIR: 0x5f9baf0 (strcmp) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5fac7a0 (__strcmp_sse2_unaligned) redirected to 0x4c2f1b0 (strcmp)
    --17490-- REDIR: 0x574b5d0 (operator new(unsigned long)) redirected to 0x4c2b070 (operator new(unsigned long))
    --17490-- REDIR: 0x5f9d9b0 (__GI_strncmp) redirected to 0x4c2e930 (__GI_strncmp)
    --17490-- REDIR: 0x5f97ca0 (calloc) redirected to 0x4c2cbf0 (calloc)
    --17490-- REDIR: 0x5f971d0 (malloc) redirected to 0x4c2ab10 (malloc)
    --17490-- REDIR: 0x5fa6200 (__GI_memcpy) redirected to 0x4c2fc90 (__GI_memcpy)
    --17490-- REDIR: 0x5fa61b0 (memcpy@@GLIBC_2.14) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5faca50 (__memcpy_sse2_unaligned) redirected to 0x4c2f6b0 (memcpy@@GLIBC_2.14)
    --17490-- REDIR: 0x5f97870 (free) redirected to 0x4c2bd80 (free)
    --17490-- REDIR: 0x5fa8540 (strchrnul) redirected to 0x4c319b0 (strchrnul)
    --17490-- REDIR: 0x601d840 (__strcpy_chk) redirected to 0x4c31a30 (__strcpy_chk)
    --17490-- REDIR: 0x5f9fe90 (__GI_strstr) redirected to 0x4c32030 (__strstr_sse2)
    --17490-- REDIR: 0x5fa09e0 (bcmp) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x6074ba0 (__memcmp_sse4_1) redirected to 0x4c30c00 (__memcmp_sse4_1)
    --17490-- REDIR: 0x5f9d960 (strncmp) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x6055fa0 (__strncmp_ssse3) redirected to 0x4c2e8c0 (strncmp)
    --17490-- REDIR: 0x5fa1040 (memset) redirected to 0x4c31350 (memset)
    --17490-- REDIR: 0x6064bd0 (__memmove_ssse3_back) redirected to 0x4c2f450 (memcpy@GLIBC_2.2.5)
    --17490-- REDIR: 0x5f97970 (realloc) redirected to 0x4c2ce10 (realloc)
    --17490-- REDIR: 0x5f9f200 (strncpy) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5fb1c40 (__strncpy_sse2_unaligned) redirected to 0x4c2e770 (__strncpy_sse2_unaligned)
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libudev.so.1.3.5
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libcgmanager.so.0.0.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libnih.so.1.0.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libnih-dbus.so.1.0.0
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libdbus-1.so.3.7.6
    --17490--    object doesn't have a symbol table
    --17490-- REDIR: 0x5f9b8a0 (index) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5f9d920 (strncat) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5f9f8c0 (strspn) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5f9cf80 (strcpy) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5fa1140 (mempcpy) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5fa0450 (strstr) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5fa0690 (memchr) redirected to 0x4c2f390 (memchr)
    --17490-- REDIR: 0x6062100 (__mempcpy_ssse3_back) redirected to 0x4c31ad0 (mempcpy)
    --17490-- REDIR: 0x5f9b8d0 (__GI_strchr) redirected to 0x4c2db90 (__GI_strchr)
    --17490-- REDIR: 0x5fa8330 (rawmemchr) redirected to 0x4c319f0 (rawmemchr)
    --17490-- REDIR: 0x5f9d700 (strnlen) redirected to 0x4c2e080 (strnlen)
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/dri/r600_dri.so
    --17490--   Considering /usr/lib/x86_64-linux-gnu/dri/r600_dri.so ..
    --17490--   .. CRC mismatch (computed 996691c2 wanted 0a96572a)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libgallium.so.0.0.0
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libgallium.so.0.0.0 ..
    --17490--   .. CRC mismatch (computed d080711e wanted 6455b286)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libelf-0.158.so
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libexpat.so.1.6.0
    --17490--   Considering /lib/x86_64-linux-gnu/libexpat.so.1.6.0 ..
    --17490--   .. CRC mismatch (computed 8f384202 wanted da130668)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libdrm_radeon.so.1.0.1
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libLLVM-3.4.so.1
    --17490--    object doesn't have a symbol table
    --17490-- REDIR: 0x401ab10 (stpcpy) redirected to 0x4c31120 (stpcpy)
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libffi.so.6.0.1
    --17490--   Considering /usr/lib/x86_64-linux-gnu/libffi.so.6.0.1 ..
    --17490--   .. CRC mismatch (computed cbfcaa4a wanted 2012f49a)
    --17490--    object doesn't have a symbol table
    --17490-- Reading syms from /lib/x86_64-linux-gnu/libtinfo.so.5.9
    --17490--   Considering /lib/x86_64-linux-gnu/libtinfo.so.5.9 ..
    --17490--   .. CRC mismatch (computed a766b3f6 wanted 5ffaddcc)
    --17490--    object doesn't have a symbol table
    --17490-- REDIR: 0x601d5a0 (__memcpy_chk) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5f9d0a0 (strcspn) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5fa1630 (stpcpy) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x5f9b6a0 (strcat) redirected to 0x4a25720 (_vgnU_ifunc_wrapper)
    --17490-- REDIR: 0x57498d0 (operator delete(void*)) redirected to 0x4c2c250 (operator delete(void*))
    --17490-- REDIR: 0xffffffffff600000 (???) redirected to 0x38068313 (???)
    --17490-- REDIR: 0x5fa1670 (__GI_stpcpy) redirected to 0x4c30da0 (__GI_stpcpy)
    --17490-- REDIR: 0xffffffffff600400 (???) redirected to 0x3806831d (???)
    --17490-- REDIR: 0x5fa0e20 (__GI_memmove) redirected to 0x4c31660 (__GI_memmove)
    --17490-- Reading syms from /usr/lib/x86_64-linux-gnu/libtxc_dxtn_s2tc.so.0.0.0
    --17490--    object doesn't have a symbol table
    --17490-- REDIR: 0x6051c00 (__strspn_sse42) redirected to 0x4c32220 (strspn)
    --17490-- REDIR: 0x5fb5cb0 (__strstr_sse2_unaligned) redirected to 0x4c31fa0 (strstr)
    --17490-- REDIR: 0x5f99320 (posix_memalign) redirected to 0x4c2d1f0 (posix_memalign)
    --17490-- REDIR: 0x5fb4430 (__strcat_sse2_unaligned) redirected to 0x4c2dd90 (strcat)
    ==17490== Invalid read of size 1
    ==17490==    at 0x450BC0: odfaeg::Action::Action(odfaeg::Action const&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x450C06: odfaeg::Action::Action(odfaeg::Action const&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x450DDD: odfaeg::Action::Action(odfaeg::Action::EVENT_TYPE, odfaeg::Action&, odfaeg::Action&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x451209: odfaeg::Action::operator||(odfaeg::Action&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x431D7A: main (main.cpp:9)
    ==17490==  Address 0x18 is not stack'd, malloc'd or (recently) free'd
    ==17490== 
    ==17490== 
    ==17490== Process terminating with default action of signal 11 (SIGSEGV)
    ==17490==  Access not within mapped region at address 0x18
    ==17490==    at 0x450BC0: odfaeg::Action::Action(odfaeg::Action const&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x450C06: odfaeg::Action::Action(odfaeg::Action const&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x450DDD: odfaeg::Action::Action(odfaeg::Action::EVENT_TYPE, odfaeg::Action&, odfaeg::Action&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x451209: odfaeg::Action::operator||(odfaeg::Action&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x431D7A: main (main.cpp:9)
    ==17490==  If you believe this happened as a result of a stack
    ==17490==  overflow in your program's main thread (unlikely but
    ==17490==  possible), you can try to increase the size of the
    ==17490==  main thread stack using the --main-stacksize= flag.
    ==17490==  The main thread stack size used in this run was 8388608.
    ==17490== 
    ==17490== HEAP SUMMARY:
    ==17490==     in use at exit: 2,300,221 bytes in 2,693 blocks
    ==17490==   total heap usage: 4,534 allocs, 1,841 frees, 3,220,199 bytes allocated
    ==17490== 
    ==17490== Searching for pointers to 2,693 not-freed blocks
    ==17490== Checked 13,312,216 bytes
    ==17490== 
    ==17490== LEAK SUMMARY:
    ==17490==    definitely lost: 0 bytes in 0 blocks
    ==17490==    indirectly lost: 0 bytes in 0 blocks
    ==17490==      possibly lost: 25,294 bytes in 264 blocks
    ==17490==    still reachable: 2,274,927 bytes in 2,429 blocks
    ==17490==         suppressed: 0 bytes in 0 blocks
    ==17490== Rerun with --leak-check=full to see details of leaked memory
    ==17490== 
    ==17490== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 1 from 1)
    ==17490== 
    ==17490== 1 errors in context 1 of 1:
    ==17490== Invalid read of size 1
    ==17490==    at 0x450BC0: odfaeg::Action::Action(odfaeg::Action const&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x450C06: odfaeg::Action::Action(odfaeg::Action const&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x450DDD: odfaeg::Action::Action(odfaeg::Action::EVENT_TYPE, odfaeg::Action&, odfaeg::Action&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x451209: odfaeg::Action::operator||(odfaeg::Action&) (in /home/laurent/Développement/Projets-c++/ODFAEG-DEMO/bin/Debug/ODFAEG-DEMO)
    ==17490==    by 0x431D7A: main (main.cpp:9)
    ==17490==  Address 0x18 is not stack'd, malloc'd or (recently) free'd
    ==17490== 
    --17490-- 
    --17490-- used_suppression:      1 dl-hack4-64bit-addr-1 /usr/lib/valgrind/default.supp:1234
    ==17490== 
    ==17490== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 1 from 1)
    Processus arrêté
    Merci d'avance pour votre aide.

  2. #2
    Invité
    Invité(e)
    Par défaut
    Mmmm, à priori il semble qu'il m'appelle le constructeur de copie en boucle, lors de l'appel à std::make_unique je vais essayé d'appeler un autre constructeur que le constructeur de copie.

  3. #3
    Expert éminent sénior

    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    5 189
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 5 189
    Points : 17 141
    Points
    17 141
    Par défaut
    Vu que tu trouves quasiment toujours quel est ton problème avant qu'on te réponde, tu ne pourrais pas essayer de réfléchir un peu plus longtemps avant de demander?

    Non qu'on ne veuille t'aider, mais c'est assez dommage de voir des sujets lancé par quelqu'un, répondu par lui-même, sans autre intervention.
    Mes principes de bases du codeur qui veut pouvoir dormir:
    • Une variable de moins est une source d'erreur en moins.
    • Un pointeur de moins est une montagne d'erreurs en moins.
    • Un copier-coller, ça doit se justifier... Deux, c'est un de trop.
    • jamais signifie "sauf si j'ai passé trois jours à prouver que je peux".
    • La plus sotte des questions est celle qu'on ne pose pas.
    Pour faire des graphes, essayez yEd.
    le ter nel est le titre porté par un de mes personnages de jeu de rôle

  4. #4
    Invité
    Invité(e)
    Par défaut
    Ok je comprends mais là je ne vois pas du tout comment régler le problème.

    J'ai essayé de cloner le std::unique_ptr mais sans succès :

    Code cpp : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
     
    Action::Action(const Action& other) {
        leaf = other.leaf;
        pressed = other.pressed;
        startEvent = other.startEvent;
        is_not = other.is_not;
        comparator = other.comparator;
        pressed = other.pressed;
        type = other.type;
        leftChild = other.leftChild.get()->clone();
        rightChild = other.rightChild.get()->clone();
    }
    std::unique_ptr<Action> Action::clone() {
        if (type == KEY_PRESSED_ONCE || type == KEY_HELD_DOWN || type == KEY_RELEASED)
            return std::make_unique<Action>(type, startEvent.key.code);
        if (type == MOUSE_BUTTON_PRESSED_ONCE || type == MOUSE_BUTTON_HELD_DOWN || type == MOUSE_BUTTON_RELEASED)
            return std::make_unique<Action>(type, startEvent.mouseButton.button);
        if (type == COMBINED_WITH_AND || type == COMBINED_WITH_XOR || type == COMBINED_WITH_OR)
            return std::make_unique<Action>(type, *leftChild, *rightChild);
        return std::make_unique<Action>(type);
    }

    J'ai toujours ce même crash.
    Quand je commente les lignes ou je clone le std::unique_ptr ça ne crash plus par contre les feuilles de mon BSP-TREE ne sont pas clonée évidement. (leftChild et rightChild sont nullptr)

    Est qu'il y a vraiment moyen de faire ça avec un std::unique_ptr, ne devrais je pas utiliser un std::shared_ptr plutôt ?

    Merci.

  5. #5
    Invité
    Invité(e)
    Par défaut
    Mmm il me semble que le shared_ptr est indispensable ici car je dois copier l'adresse du pointeur. (et non pas le contenu du pointeur)

    Donc j'ai remplacé le std::unique_ptr par un std::shared_ptr, mais, si quelqu'un à une meilleure solution je suis preneur.

  6. #6
    Membre éprouvé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2014
    Messages
    345
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Juin 2014
    Messages : 345
    Points : 1 211
    Points
    1 211
    Par défaut
    Citation Envoyé par leternel Voir le message
    Vu que tu trouves quasiment toujours quel est ton problème avant qu'on te réponde, tu ne pourrais pas essayer de réfléchir un peu plus longtemps avant de demander?

    Non qu'on ne veuille t'aider, mais c'est assez dommage de voir des sujets lancé par quelqu'un, répondu par lui-même, sans autre intervention.
    Non mais le pire c'est qu'il le fait à chaque thread, non seulement aux je-sais-pas-combien de threads qu'il a lancés, mais sur ceux des autres même quand y'a pas de rapport
    Et bien sûr il ignore les réponses.
    Perso j'ai arrêté de réfléchir à une solution, suffit de faire F5 et y'en a une qui pop (pas forcément la meilleure d'ailleurs, mais les autres étant automatiquement ignorées ...)

  7. #7
    Expert éminent sénior

    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    5 189
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 5 189
    Points : 17 141
    Points
    17 141
    Par défaut
    On dirait une série.
    Après Batman, Superman, voici lolilolight, le développeur!

    Au dernier épisode, il cherchait à cloner un unique_ptr...
    Parviendra-t-il à déterminer qui possède la donnée pointée?
    Saura-t-il voir que la donnée est interne ou externe?
    Comprendra-t-il qu'une donnée interne n'est jamais donnée, mais copiée en sortie?
    Qu'une donnée externe ne dois pas être possédée?
    Mes principes de bases du codeur qui veut pouvoir dormir:
    • Une variable de moins est une source d'erreur en moins.
    • Un pointeur de moins est une montagne d'erreurs en moins.
    • Un copier-coller, ça doit se justifier... Deux, c'est un de trop.
    • jamais signifie "sauf si j'ai passé trois jours à prouver que je peux".
    • La plus sotte des questions est celle qu'on ne pose pas.
    Pour faire des graphes, essayez yEd.
    le ter nel est le titre porté par un de mes personnages de jeu de rôle

  8. #8
    Invité
    Invité(e)
    Par défaut
    Ha voila. (le problème était ici)

    Code cpp : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    Action Action::operator| (Action other) {
        Action result (COMBINED_WITH_XOR, *this, other);
        return result;
    }
    Action Action::operator|| (Action other) {
        Action result (COMBINED_WITH_XOR, *this, other);
        return result;
    }
    Action Action::operator&& (Action other) {
        Action result (COMBINED_WITH_XOR, *this, other);
        return result;

    Je ne peux pas créer un unique_ptr sur une donnée temporaire, sinon elle sera détruite avec le std::unique_ptr.
    Donc je la copie et ensuite je fais le std::unique_ptr.

    Bon maintenant j'ai un autre problème avec le thread, mais je vais chercher un peu cette fois avant de poster.

  9. #9
    Expert éminent sénior

    Femme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2007
    Messages
    5 189
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels

    Informations forums :
    Inscription : Juin 2007
    Messages : 5 189
    Points : 17 141
    Points
    17 141
    Par défaut
    Normalement, le constructeur de unique_ptr doit recevoir directement un new.

    unique_ptr supprime l'écriture des delete par le code métier.
    De la même manière, make_unique supprime l'écriture de new, en le faisant lui-même.

    Il n'en reste pas moins que donner l'adresse d'une variable sera nécessairement une faute.
    Mes principes de bases du codeur qui veut pouvoir dormir:
    • Une variable de moins est une source d'erreur en moins.
    • Un pointeur de moins est une montagne d'erreurs en moins.
    • Un copier-coller, ça doit se justifier... Deux, c'est un de trop.
    • jamais signifie "sauf si j'ai passé trois jours à prouver que je peux".
    • La plus sotte des questions est celle qu'on ne pose pas.
    Pour faire des graphes, essayez yEd.
    le ter nel est le titre porté par un de mes personnages de jeu de rôle

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème : variable non modifiée dans mon BSP-TREE!
    Par Invité dans le forum Langage
    Réponses: 1
    Dernier message: 06/11/2014, 13h37
  2. Crash lors de l'ouverture de mon programme
    Par jimmplan dans le forum MFC
    Réponses: 16
    Dernier message: 16/10/2008, 22h35
  3. pb lors de l'exécution de mon animation
    Par pitchounette13 dans le forum Flash
    Réponses: 1
    Dernier message: 17/05/2006, 09h30
  4. pb lors de l'exécution de mon prgm
    Par salseropom dans le forum C
    Réponses: 2
    Dernier message: 14/12/2005, 09h33
  5. Problème lors de la transformation de mon "algorithm&qu
    Par prunodagen dans le forum Langage SQL
    Réponses: 8
    Dernier message: 27/04/2005, 21h48

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo