Advertisement Jump to content
Sign in to follow this  

Loki bug (which you can easily reproduce)

This topic is 4969 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

if you're bored [smile] Think Verg is still a dope? [smile] Here's the source which will cause a Loki library bug to happen, if you're bored and wanna try it... NOTE: You'll have to include the Loki files Singleton.cpp and SmallObj.cpp, as well as make the Loki header files available to your test project for it to build... The header file "test_3.h":
* Loki library: potential bug #1219255                      *
*                                                           *
* Test case which causes apparent failure inside            *
* SmallObj.cpp vers 1.3                                     *
*                                                           *
* Files where bug was discovered were from:                 *
* (  *
*                                                           *
* Originals can be found at:                                *
* (                *
*                                                           *
* by: Chad Lehman (          *
* Date: June 12, 2005                                       *
*                                                           *

// The following test will cause the ASSERT on line 292
// of Rich's "SmallObj.cpp" to fail:

// assert( ( NULL == emptyChunk_ ) || ( emptyChunk_->HasAvailable( numBlocks_ ) ) );
// The emptyChunk_ pointer points to a chunk whose available
// blocks appear to be:
// emptyChunk->blocksAvailable_ == 254
// The following only appears to happen if the SmartPtr
// uses the RefCountedMTAdj<ClassLevelLockable>::RefCountedMT
// Ownership Policy.
// The assert comes after the second call to void testIt()
// inside int main()

#include <windows.h>	// so that _WINDOWS_ macro is
						// defined, which allows
						// ClassLevelLockable to be defined

#include <loki/SmartPtr.h>
#include <loki/Functor.h>

extern int main();
void testIt();

namespace testcase{

	using namespace Loki;

class holder{


	class innerClass



	typedef SmartPtr<innerClass, RefCountedMTAdj<ClassLevelLockable>::RefCountedMT >				inner_class_ptr_type;

	virtual ~holder(){}


	// assert fails! (line 292 SmallObj.cpp): 
	// When attempting to create this SmartPtr inside a
	// second object of type "holder"

	inner_class_ptr_type									_innerclass;


The .cpp file:
#include "test_3.h"

void testIt()
	testcase::holder h;

int main()
	testIt();     // uh oh! Trouble here!!

	return 0;

[smile] Yep, Verg is still a dope [lol]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!