Commit 09b4f299 authored by cutealien's avatar cutealien

Bugfix: irrArray should no longer crash when using other allocators....

Bugfix: irrArray should no longer crash when using other allocators. Corresponding test added. This was 
caused because operator= and copy-constructor where not called because the the second template parameters 
was not used in those function declarations and so only functions for the default parameter had been 
created. 


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2949 dfc29bdd-3216-0410-991c-e03cc46cb475
parent e7b200fe
Changes in 1.7
- Bugfix: irrArray should no longer crash when using other allocators.
- Add MaterialViewer example.
- Checkbox uses now disabled text color when disabled.
......
......@@ -42,7 +42,7 @@ public:
//! Copy constructor
array(const array<T>& other) : data(0)
array(const array<T, TAlloc>& other) : data(0)
{
*this = other;
}
......@@ -247,7 +247,7 @@ public:
//! Assignment operator
void operator=(const array<T>& other)
void operator=(const array<T, TAlloc>& other)
{
strategy = other.strategy;
......@@ -271,7 +271,7 @@ public:
//! Equality operator
bool operator == (const array<T>& other) const
bool operator == (const array<T, TAlloc>& other) const
{
if (used != other.used)
return false;
......@@ -284,7 +284,7 @@ public:
//! Inequality operator
bool operator != (const array<T>& other) const
bool operator != (const array<T, TAlloc>& other) const
{
return !(*this==other);
}
......
......@@ -52,6 +52,7 @@ int main(int argumentCount, char * arguments[])
TEST(disambiguateTextures); // Normally you should run this first, since it validates the working directory.
// Now the simple tests without device
TEST(testArray);
TEST(exports);
TEST(irrCoreEquals);
TEST(testIrrString);
......
// Copyright (C) 2008-2009 Colin MacDonald
// No rights reserved: this software is in the public domain.
#include "testUtils.h"
#include <irrlicht.h>
#include <assert.h>
using namespace irr;
using namespace core;
struct VarArray
{
core::array < int, core::irrAllocatorFast<int> > MyArray;
};
// this will (did once) simply crash when wrong, so no return value
void crashTestFastAlloc()
{
core::array < VarArray, core::irrAllocatorFast<VarArray> > ArrayArray;
ArrayArray.setAllocStrategy(core::ALLOC_STRATEGY_SAFE); // force more re-allocations
VarArray var;
var.MyArray.setAllocStrategy(core::ALLOC_STRATEGY_SAFE); // force more re-allocations
var.MyArray.push_back( 0 );
for ( int i=0; i< 100; ++i )
{
ArrayArray.push_back(var);
ArrayArray.push_back(var);
}
}
// Test the functionality of core::array
bool testArray(void)
{
bool allExpected = true;
logTestString("crashTestFastAlloc\n");
crashTestFastAlloc();
if(allExpected)
logTestString("\nAll tests passed\n");
else
logTestString("\nFAIL!\n");
return allExpected;
}
Test suite pass at GMT Mon Nov 30 14:06:12 2009
Test suite pass at GMT Mon Nov 30 14:42:09 2009
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment