Bonjour à tous!

Bon la je sais même pas exactement quels éléments présenter pour aider à la résolution du problème, un peu paumé le Tet2brick

En gros j'ai une classe Application et dans la section private j'ai entre autre ceci:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
std::vector< std::vector< int > > *pathGrid;
std::vector< Ogre::Vector3 > *movableObjects;
Et je les initialise plus loin:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
 
pathGrid= new std::vector< std::vector< int > >(MAPSIZE,std::vector<int> (MAPSIZE,100000));
movableObjects= new std::vector< Ogre::Vector3 >(0);


Deux pointeurs vers des vecteurs que je vais utiliser dans toute la classe et que je vais envoyer à d'autres objets pour qu'ils puissent les manipuler.

Mais lorsque je lance l'application elle plante en me retournant un "Access violation writing location... " (selon mes modifications que j'ai testées soit à l'initialisation, soit plus loin dans le code mais sans que je voie vraiment le rapport avec ces variables précises)

Par contre si je retire le vecteur movableObjects, tout fonctionne parfaitement, comme si je ne pouvais pas créer un second pointeur vers un vecteur...

Vous avez une idée?


Merci d'avance

Au cas ou la totalité du fichier main.cpp (je peux fournir les autres fichiers au besoin)
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
 
#include <Ogre.h>
#include <OIS/OIS.h>
#include <CEGUI/CEGUI.h>
#include <OgreCEGUIRenderer.h>
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <iostream>
#include <string>
 
#include "data.h"
 
#include "Level.h"
#include "KeyFrameListener.h"
 
using namespace Ogre;
 
 
 
 
class Application
{
public:
 
	void go()
    {
 
		pathGrid= new std::vector< std::vector< int > >(MAPSIZE,std::vector<int> (MAPSIZE,100000));
		movableObjects= new std::vector< Ogre::Vector3 >(0);
 
		createRoot();
        defineResources();
        setupRenderSystem();
        createRenderWindow();
        initializeResourceGroups();
        setupScene();
        setupInputSystem();
        setupCEGUI();
        createFrameListener();
        startRenderLoop();
    }
 
    ~Application()
    {
        mInputManager->destroyInputObject(mKeyboard);
        OIS::InputManager::destroyInputSystem(mInputManager);
		delete mListener;
        delete mRoot;
    }
 
private:
    Root *mRoot;
    OIS::Keyboard *mKeyboard;
	OIS::Mouse *mMouse;
    OIS::InputManager *mInputManager;
    KeyFrameListener *mListener;
	CEGUI::OgreCEGUIRenderer *mRenderer;
    CEGUI::System *mSystem;
	Ogre::Vector3 *target;
	std::vector< std::vector< int > > *pathGrid;
	std::vector< Ogre::Vector3 > *movableObjects;
 
 
    void createRoot()
    {
        mRoot = new Root();
    }
 
    void defineResources()
    {
        String secName, typeName, archName;
        ConfigFile cf;
        cf.load("resources.cfg");
 
        ConfigFile::SectionIterator seci = cf.getSectionIterator();
        while (seci.hasMoreElements())
        {
            secName = seci.peekNextKey();
            ConfigFile::SettingsMultiMap *settings = seci.getNext();
            ConfigFile::SettingsMultiMap::iterator i;
            for (i = settings->begin(); i != settings->end(); ++i)
            {
                typeName = i->first;
                archName = i->second;
                ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
            }
        }
    }
 
    void setupRenderSystem()
    {
        if (!mRoot->restoreConfig() && !mRoot->showConfigDialog())
            throw Exception(52, "User canceled the config dialog!", "Application::setupRenderSystem()");
 
        //// Do not add this to the application
        //RenderSystem *rs = mRoot->getRenderSystemByName("Direct3D9 Rendering Subsystem");
        //                                      // or use "OpenGL Rendering Subsystem"
        //mRoot->setRenderSystem(rs);
        //rs->setConfigOption("Full Screen", "No");
        //rs->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
    }
 
    void createRenderWindow()
    {
        mRoot->initialise(true, "Tutorial Render Window");
 
        //// Do not add this to the application
        //mRoot->initialise(false);
        //HWND hWnd = 0;  // Get the hWnd of the application!
        //NameValuePairList misc;
        //misc["externalWindowHandle"] = StringConverter::toString((int)hWnd);
        //RenderWindow *win = mRoot->createRenderWindow("Main RenderWindow", 800, 600, false, &misc);
    }
 
    void initializeResourceGroups()
    {
        TextureManager::getSingleton().setDefaultNumMipmaps(5);
        ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    }
 
    void setupScene()
    {
        /*SceneManager *mgr = mRoot->createSceneManager(ST_GENERIC, "Default_SceneManager");
        Camera *cam = mgr->createCamera("Camera");
        Viewport *vp = mRoot->getAutoCreatedWindow()->addViewport(cam);*/
 
		//tableaux pour le pathfinding
		/*std::vector <Ogre::Vector3 *> pathNodes(1,&Ogre::Vector3());
		std::vector <bool> pathNodesWalkable(1,true);*/
 
		//std::vector< std::vector< int > > pathGrid(256,std::vector<int> (256,100));
		//std::vector<Ogre::String> movableObjects(1,"tmp");
		//std::vector<Ogre::Entity *>	selectedObjects;
 
 
		Level::Level(mRoot, pathGrid);
 
 
 
 
 
    }
 
    void setupInputSystem()
    {
        size_t windowHnd = 0;
        std::ostringstream windowHndStr;
        OIS::ParamList pl;
        RenderWindow *win = mRoot->getAutoCreatedWindow();
 
        win->getCustomAttribute("WINDOW", &windowHnd);
        windowHndStr << windowHnd;
        pl.insert(std::make_pair(std::string("WINDOW"), windowHndStr.str()));
        mInputManager = OIS::InputManager::createInputSystem(pl);
 
        try
        {
            mKeyboard = static_cast<OIS::Keyboard*>(mInputManager->createInputObject(OIS::OISKeyboard, true));
            mMouse = static_cast<OIS::Mouse*>(mInputManager->createInputObject(OIS::OISMouse, true));
            //mJoy = static_cast<OIS::JoyStick*>(mInputManager->createInputObject(OIS::OISJoyStick, false));
        }
        catch (const OIS::Exception &e)
        {
            throw new Exception(42, e.eText, "Application::setupInputSystem");
        }
    }
 
    void setupCEGUI()
    {
        SceneManager *mgr = mRoot->getSceneManager("Default_SceneManager");
        RenderWindow *win = mRoot->getAutoCreatedWindow();
 
        // CEGUI setup
        mRenderer = new CEGUI::OgreCEGUIRenderer(win, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mgr);
        mSystem = new CEGUI::System(mRenderer);
 
        // Other CEGUI setup here.
 
		CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
        CEGUI::MouseCursor::getSingleton().setImage((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
 
 
 
 
    }
 
    void createFrameListener()
    {
        /*mListener = new ExitListener(mKeyboard);
        mRoot->addFrameListener(mListener);*/
 
 
 
		mListener = new KeyFrameListener(mKeyboard, mMouse, mRoot, target, pathGrid);
        mRoot->addFrameListener(mListener);
    }
 
    void startRenderLoop()
    {
		mRoot->startRendering();
 
        //// Do not add this to the application
        //while (mRoot->renderOneFrame())
        //{
        //    // Do some things here, like sleep for x milliseconds or perform other actions.
        //}
    }
};
 
#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
 
INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
#else
int main(int argc, char **argv)
#endif
{
    try
    {
        Application app;
        app.go();
    }
    catch(Exception& e)
    {
#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
        MessageBoxA(NULL, e.getFullDescription().c_str(), "An exception has occurred!", MB_OK | MB_ICONERROR | MB_TASKMODAL);
#else
        fprintf(stderr, "An exception has occurred: %s\n",
            e.getFullDescription().c_str());
#endif
    }
 
    return 0;
}