Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - nomonkeybusiness

Pages: [1]
1
General / SFML game engine crashes on exit
« on: October 24, 2009, 11:12:44 pm »
Quote from: "Nexus"
Why do you always blame others for the mistake? ;)
You might also try a memory-tool like valgrind...


I absolutely consider this my fault. I don't think that the problem is inside sfml, the reason I post here, is because the problem seems related to sfml, so I wan't to know if something happens inside sfml, that I am unaware of, and therefore, make some mistake.

I will check that out. It's for checking meamory-leakage, am I right?

Quote from: "Nexus"
lesson


Thanks for the lesson :)
It's always good to be "corrected", as I always strive to learn as much as I can.
If setting the pointer to NULL in safe-delete is bad, then I won't do it. My thoughts on the name "SAFE_DELETE" were to assure myself of both deleting and nulling the ptr. I don't really know why. I think I saw someone else do it, and it looked kind of handy. I'm lazy :/

2
General / SFML game engine crashes on exit
« on: October 24, 2009, 10:28:33 pm »
Other than a couple of static singletons, I use none of those. So you are saying that the problem might be some sfml-type that are ruining my program?

3
General / SFML game engine crashes on exit
« on: October 24, 2009, 09:44:10 pm »
But since the problem arises after it has left main(), then it shouldn't be a problem. I don't think that the program, behind the scenes tries to free memory that I allready freed myself.

4
General / SFML game engine crashes on exit
« on: October 24, 2009, 09:03:29 pm »
Code: [Select]
nvoglnt.dll!6973d170()
 [Frames below may be incorrect and/or missing, no symbols loaded for nvoglnt.dll]
 nvoglnt.dll!6973d4fb()
 nvoglnt.dll!6975ae2a()
 nvoglnt.dll!69597bae()
 nvoglnt.dll!6958949d()
 nvoglnt.dll!6973af57()
 opengl32.dll!5ed19652()
 opengl32.dll!5ed19aad()
 opengl32.dll!5ed19c5f()
 sfml-window-d.dll!003b9069()
 sfml-window-d.dll!003bda1b()
 sfml-graphics-d.dll!101f583c()
 sfml-graphics-d.dll!101f5b20()
 sfml-graphics-d.dll!101f59d1()
 ntdll.dll!7c90118a()
 ntdll.dll!7c923ada()
 ntdll.dll!7c910435()
 ntdll.dll!7c91043e()
 ntdll.dll!7c923c88()
 kernel32.dll!7c81cb26()
msvcr90d.dll!__crtExitProcess(int status=0)  Line 732 C
msvcr90d.dll!doexit(int code=0, int quick=0, int retcaller=0)  Line 644 + 0x9 bytes C
msvcr90d.dll!exit(int code=0)  Line 412 + 0xd bytes C
Engine.exe!__tmainCRTStartup()  Line 595 C
Engine.exe!mainCRTStartup()  Line 399 C
kernel32.dll!7c817077()


Here's my call stack, when the error arises.
As you can see, some calls are made in both sfml-graphics-d.dll and opengl32.dll. This has made me to believe that my mistake lies in not freeing some memory allocated with sfml. Am I wrong?

5
General / SFML game engine crashes on exit
« on: October 24, 2009, 08:15:35 pm »
I do indeed use the debug-libraries. Is there anything else I should know? Like use of MFC etc.

And the pointer I delete is the same that I new.
Anyway, the engine is built so that it should be easy to create and destroy entities, which means that there are indeed some memory-allocation/deallocation going on, both for sf::Sprites and iGameEntities(or rather it's different children classes). I use my SAFE_DELETE macro pretty much anywhere I destroy stuff. So tell me, why is it wrong to use this macro?

6
General / Checking for a non-transparent spot at (x,y)
« on: October 23, 2009, 12:31:52 am »
This seems like a really long updatecycle.
Try to narrow it down. Use boundingbox-testings to see if it is really necessary to do the pixelcollisiontesting at all. Here's what I would do with your code:

Code: [Select]
Object::Update()
{
     // Add the two vectors together
     m_vPosition += m_vVelocity;
     
     bool bCollided = CheckCollisionToTerrain();
     
     if(bCollided)
     {
           m_vPosition -= m_vVelocity;
     }

     // other necessary updates here
}

7
General / SFML game engine crashes on exit
« on: October 22, 2009, 11:32:20 pm »
Hi all!
I've been building a simple game engine the last 5-6 weeks using sfml for rendering and input. I've had no problems at all, until just this morning. All of a sudden, the program crashes when I destroy all my managers, specifically, when destroying cRenderManager.
I can see from the callstack in debug, that the problem arises in ~cRenderManager() and all that happens there is this simple line of code:
"SAFE_DELETE(m_pMainRenderWindow);"
with the macro-definition as follows:
"
#ifndef SAFE_DELETE
#define SAFE_DELETE(p) if(p) { delete p; } p = NULL;
#endif // SAFE_DELETE
"
I can also see from the callstack that it involves functions from the files free.c, dbgdel.c and dbgheap.c, from msvcr90d.dll.
It definitly seems like there is some sort of memory proplem, but I have no idea how to solve it. Do anybody know?

Edit: It does not matter if I delete m_pMainRenderWindow in the destructor or anywhere else. As soon as I try to delete it, the error arises.

Edit 2: I just noticed that If I do not delete the renderwindow, an error arises in the cGraphicalEntitys destructor, where I try to delete their sf::Sprite membervariables.
If I do NOT delete any of them, an error arises anyway in free.c, on line 109:
"retval = HeapFree(_crtheap, 0, pBlock);
 if (retval == 0)
 {
       errno = _get_errno_from_oserr(GetLastError());
 }"

Please help me, I'm really no expert on memory allocations.

8
Window / Is there a GetError() in sfml?
« on: February 24, 2009, 04:17:32 pm »
Oh. Didn't know that. Well, it seems kind of...not good to initialize a new renderwindow for the purpose of drawing stuff on, so a would like to obtain the main renderwindow, the one that I initialize in my cApp-class.

9
Window / Is there a GetError() in sfml?
« on: February 24, 2009, 04:00:14 pm »
While we're on the subject of comparing SDL and SFML.
I'm building a basic framework, and I'm having a "drawImage()" in my cRenderTools class.
Is there any way of obtaining the renderwindow to draw on, from an outside class without having to send it there via function arguments?
Like sdl's SDL_GetVideoSurface() ?

10
Window / Is there a GetError() in sfml?
« on: February 24, 2009, 03:57:59 pm »
Yes, i just noticed, thank you ;)

11
Window / Is there a GetError() in sfml?
« on: February 24, 2009, 01:32:45 pm »
Hi all! I'm new to the forum, and new to SFML.
I am studying at Gotland University, where I study to become a game programmer. I have previously used SDL to build games, and I think I have a decent knowledge of C++.
Anyhow. I am just getting started with SFML, and I'm wondering wether there is a function similar to SDL's "SDL_GetError()" wich returns a const char*, containing a description of the last error that occured. So..is there?
Thanks

/Christoffer

Pages: [1]