Bonjour !

Ca fait un petit peu de temps que je suis sur cette erreur, et je vois pas du tout vers ou me tourner pour resoudre ca.

Voici la fonction qui m'envoie ce demon ! (En gras, l'erreur SIGSEGV)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
void Clips::addClip(string g, SDL_Rect* r)
{
    if(_spr->rects.find(g) == _spr->rects.end())
    {
        _spr->rects.insert(make_pair(g, vector<SDL_Rect*>()));
    }
    _spr->rects.find(g)->second.push_back(r);
    ++_spr->scount;
    if(_spr->index < 0) { _spr->index = 0; }
    _spr->ci = _spr->rects[g].begin();
}
Voici egalement toute la definition, ainsi que le constructeur
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
 
struct __sprite {
    map<string, vector<SDL_Rect*>> rects;
    string group;
    int index;
    int scount;
    int gcount;
    bool loop; // true = animate to RIGHT, false = to LEFT
    bool _autoanimate;
    vector<SDL_Rect*>::iterator ci;
};
class Clips {
    public:
        Clips();
        void addClip(string g, SDL_Rect* r);
        void loopTo(bool dir) { _spr->loop = dir; }
        void autoanimation(bool anim) { _spr->_autoanimate = anim; }
        bool autoanimate() { return _spr->_autoanimate; }
        void refreshiterator();
        SDL_Rect* get();
        void setgroup(string g) { _spr->group = g; refreshiterator(); }
        string group() { return _spr->group; }
        bool hoverable() { return !_spr->_autoanimate; }
    private:
        void nextclip();
        __sprite* _spr;
};
Constructeur:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
 
Clips::Clips()
{
 
    shared_ptr<__sprite> _spr(new __sprite);
    _spr->_autoanimate = false;
    _spr->loop = true;
    _spr->scount = 0;
    _spr->gcount = 0;
    _spr->index = -1;
    _spr->group = "";
}
Voici également le resultat du débug !
#0 0046D083 std::_Rb_tree<std::string, std::pair<std::string const, std::vector<SDL_Rect*, std::allocator<SDL_Rect*> > >, std::_Select1st<std::pair<std::string const, std::vector<SDL_Rect*, std::allocator<SDL_Rect*> > > >, std::less<std::string>, std::allocator<std::pair<std::string const, std::vector<SDL_Rect*, std::allocator<SDL_Rect*> > > > >::_M_begin(this=0xbaadf00d) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_tree.h:482)
#1 0046CF64 std::_Rb_tree<std::string, std::pair<std::string const, std::vector<SDL_Rect*, std::allocator<SDL_Rect*> > >, std::_Select1st<std::pair<std::string const, std::vector<SDL_Rect*, std::allocator<SDL_Rect*> > > >, std::less<std::string>, std::allocator<std::pair<std::string const, std::vector<SDL_Rect*, std::allocator<SDL_Rect*> > > > >::find(this=0xbaadf00d, __k=@0x28fbb4) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_tree.h:1421)
#2 00469995 std::map<std::string, std::vector<SDL_Rect*, std::allocator<SDL_Rect*> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::vector<SDL_Rect*, std::allocator<SDL_Rect*> > > > >::find(this=0xbaadf00d, __x=@0x28fbb4) (c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.4.1/include/c++/bits/stl_map.h:659)
#3 00404132 Clips::addClip(this=0x915238, g={static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x915284 "stand"}}, r=0x915258) (D:\C++\projects\Client v2\Factories\Tools.cpp:16)
#4 00406072 __WFSprite(this=0x9150b8, spritesheet={static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x28fca8 "\224P\221"}}, p={x = 200, y = 200}, s={x = 80, y = 140}) (D:\C++\projects\Client v2\Factories\Widgets\WFSprite.cpp:16)
#5 00423F98 WidgetFactory::Create<__WFSprite>(this=0x914d30, spritesheet={static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>}, _M_p = 0x915094 "sprite.bmp"}}, p={x = 200, y = 200}, s={x = 80, y = 140}) (D:/C++/projects/Client v2/Factories/WidgetFactory.h:29)
#6 00408516 GUIManager::Show(this=0x913480) (D:\C++\projects\Client v2\GUIManager.cpp:61)
#7 00408903 SDL_main(argc=1, argv=0x912fa0) (D:\C++\projects\Client v2\main.cpp:14)
#8 00409E49 console_main(argc=1, argv=0x912fa0) (./src/main/win32/SDL_win32_main.c:210)
#9 00000000 0x00000001 in ??() (???)
#10 00000000 0x0000001b in ??() (???)
#11 00000000 0x00000000 in ??() (???)
Apparement, le programme essaye d'acceder a la map, alors qu'elle n'a pas de memoire ?!
Pourtant, jj'ai lu un truc sur google (d'où le shared_ptr !)