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

Author Topic: Solved - Debug Assertion Failure  (Read 3816 times)

0 Members and 1 Guest are viewing this topic.

DaveKram

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Solved - Debug Assertion Failure
« on: January 29, 2015, 02:42:12 am »
Solved - see my post below

Hello all,

Let me preface this with that I've done the looking around on the forums to see if I screwed up somewhere.

With recent code changes, I've been getting a debug assertion failure - I can't seem to determine if it's my code or some setting in the projects I have changed. It's very similar to this: http://en.sfml-dev.org/forums/index.php?topic=16539.msg118780#msg118780

Here's the debug assert failure:



So it's heap corruption, but I'm not sure from where.

Here's the call stack:

Quote
>   msvcr110d.dll!_free_dbg_nolock(void * pUserData, int nBlockUse) Line 1424   C++
    msvcr110d.dll!_free_dbg(void * pUserData, int nBlockUse) Line 1265   C++
    msvcr110d.dll!operator delete(void * pUserData) Line 54   C++
    Game.exe!std::allocator<std::_Container_proxy>::deallocate(std::_Container_proxy * _Ptr, unsigned int __formal) Line 586   C++
    Game.exe!std::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >::_Free_proxy() Line 683   C++
    Game.exe!std::_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >::~_String_alloc<0,std::_String_base_types<char,std::allocator<char> > >() Line 656   C++
    Game.exe!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::~basic_string<char,std::char_traits<char>,std::allocator<char> >() Line 965   C++
    Game.exe!NetworkManager::connect() Line 41   C++
    Game.exe!NetworkManager::changeServer(std::basic_string<char,std::char_traits<char>,std::allocator<char> > ipAddress) Line 65   C++
    Game.exe!Game::Game(NetworkManager * nm) Line 18   C++
    Game.exe!GameManager::setCurGameState(int state) Line 146   C++
    Game.exe!GameManager::init(sf::RenderWindow & windowReference) Line 40   C++
    Game.exe!main() Line 16   C++
    Game.exe!__tmainCRTStartup() Line 536   C
    Game.exe!mainCRTStartup() Line 377   C
    kernel32.dll!774c919f()   Unknown
    [Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]   
    ntdll.dll!777a0bbb()   Unknown
    ntdll.dll!777a0b91()   Unknown

This is a networked application, so I have a server application as well and whenever a client connects - the same debug assert shows up on that application as well. They both break on calling an sf::IpAddress::toString().

Like in that thread above I linked, one of the solutions was to check your PATH variable for SFML references - I have no references to SFML in my path. I am using the Visual Studio 2012 SFML binaries (2.2 32bit) from the website and dynamically linking them in (they're all in the debug folder/or release depending what I'm building).

I am also using /MDd Multi-threaded Debug DLL for my Runtime Library option when compiling in debug mode (which I do most of the time) and /MD Multi-threaded DLL for Release.

Here's some example code where it breaks:

Quote
void NetworkManager::connect()
{
   remoteServerIP = refGameConfig->getValue("ServerIp");
   //Send data to connect
   sf::Packet packet;
   packet << __NETWORK_USER_CONNECTED;
   if (sendMessage(packet))
   {
      int data;
      packet >> data;
      std::cout << "Sent data to: " << remoteServerIP.toString() << ":" << UDPPort << " - Data: " << data << std::endl;
   }
}

If I remove any remoteServerIP.toString from my Game client - it runs without the debug assertion fail. This only recently has started to happen, and maybe I'm overlooking something/the corruption is somewhere else entirely.

If anyone can help point me in a direction, that would be appreciated.

Thanks,

Dave
« Last Edit: January 29, 2015, 05:45:23 am by DaveKram »

DaveKram

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: Debug Assertion Failure
« Reply #1 on: January 29, 2015, 05:44:58 am »
Sorry everyone, not really sure what happened. Reverted any changes I made while testing different things, downloaded the 32bit binaries again for VS2012 and just replaced the files.

Compile and run in debug mode, works just fine. Weirdest thing  ::)
« Last Edit: January 29, 2015, 05:50:44 am by DaveKram »