Jump to content

LEO: Framework::Free() Access violation


Paul
 Share

Recommended Posts

Calling Framework::Free() on an existing Framework causes an access violation.

The problem seems to be Layer::operator=() is treating 0 as a pointer.

Intel Core i7 975 @ 3.33GHz, 6GB ram, GTX 560 Super OC, Windows 7 Pro 64bit

Link to comment
Share on other sites

You might want to look at the way you're calling it. Framework is instantiated and therefore calling Framework::Free() is likely trying to free a non-existant instance of Framework. Try calling framework.free() instead (Or whatever you called your Framework instance).

Programmer, Modeller

Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64

Visual Studio 2008 | Photoshop CS3 | Maya 2009

Website: http://srichnet.info

Link to comment
Share on other sites

How should I be calling it?

 

This shows what I'm talking about.

#include "leo.h"
using namespace LEO ;

int WINAPI WinMain( HINSTANCE hInstance,
				HINSTANCE hPrevInstance,
				LPSTR lpCmdLine,
				int nShowCmd ) 
{
Engine engine( "Game", 800, 600 ) ;
Engine::SetAbstractPath( "E:/Program Files (x86)/Leadwerks Engine SDK" ) ;
Engine::SetFilters() ;
Engine::SetShadowQuality(DEEPSHADOW);

World world( CREATENOW ) ;
if( !world.IsValid() ) 
{
	MessageBoxA(0,"Error","Failed to create world.",MB_OK);
	return engine.Free() ;
}

Framework fw;
fw.Create();
fw.Free();

// Done
return engine.Free() ;
}

Intel Core i7 975 @ 3.33GHz, 6GB ram, GTX 560 Super OC, Windows 7 Pro 64bit

Link to comment
Share on other sites

Here's a quick fix:

inline void Framework::Free()
{
if ( m_entity && g_engineLoaded && !mIsReference  )
{
	::leFreeFramework( m_entity );
	m_entity = 0;
	renderer.Free();
	background.Free();
	main.Free();
	transparency.Free();
	listener.Free();
}
}

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...