program's crash =(

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Roman B.
Posts: 9
Joined: Wed Mar 10, 2010 8:04 am
Location: Russia
Contact:

program's crash =(

Post by Roman B. »

When i runing my project from IDE(VS2008 C++) everything fine and it works well, but when i run it separately it's crash on ten step of changing scene. here is function that's changing my scene:

Code: Select all

int tourinfo::ChangeScene()
{
	stringw tmpstring;
	stringw tmpstring1;

	if (weathershow)
	{
		//tmpstring = land[tourindex];
		TopLabel->setText(land[tourindex].c_str());

		//tmpstring = direction[tourindex];
		DirLabel->setText(direction[tourindex].c_str());

		
		tmpstring = L"1";
		tmpstring1 = weather[tourindex][1];
		tmpstring += L"°";
		//WeatherLabel1->setText(weather[tourindex][1].c_str());
		WeatherLabel1->setText(tmpstring.c_str());
		//WeatherLabel1

		tmpstring = L"облачность: ";
		tmpstring += cloudiness[tourindex];
		WeatherLabel2->setText(tmpstring.c_str());

		tmpstring = pressure[tourindex];
		tmpstring += L" mmHg, ";
		tmpstring += relwet[tourindex];
		tmpstring += L"%";
		WeatherLabel3->setText(tmpstring.c_str());

		tmpstring = L"скорость ветра: ";
		tmpstring += wind[tourindex];
		tmpstring += L" м/с";
		WeatherLabel4->setText(tmpstring.c_str());
		WeatherLabel4->setText(tmpstring.c_str());

		//tmpstring = hotel[tourindex][0] + L", вылет: " + date[tourindex][0];
		//if (hotel[tourindex][0] == " ") tmpstring = L" ";
		//FlightLabel1->setText(tmpstring.c_str());

		//tmpstring = days[tourindex][0] + L" дней, " + number[tourindex][0] + L", " + price[tourindex][0] + L" руб.";
		//if (hotel[tourindex][0] == " ") tmpstring = L" ";
		//FlightLabel2->setText(tmpstring.c_str());
	}

	return 1;
}
And after it is crashed, when i choose debug, IDE says:

Unhandled exception at 0x10003a06 in Tour3DforWindows.exe: 0xC0000005: Access violation reading location 0x1b4f9855.

in this block of irrallocator:

Code: Select all

//! Very simple allocator implementation, containers using it can be used across dll boundaries
template<typename T>
class irrAllocator
{
public:

	//! Destructor
	virtual ~irrAllocator() {}

	//! Allocate memory for an array of objects
	T* allocate(size_t cnt)
	{
		return (T*)internal_new(cnt* sizeof(T));
	}

	//! Deallocate memory for an array of objects
	void deallocate(T* ptr)
	{
		internal_delete(ptr);
	}

	//! Construct an element
	void construct(T* ptr, const T&e)
	{
		new ((void*)ptr) T(e);
	}

	//! Destruct an element
	void destruct(T* ptr)
	{
		ptr->~T();
	}

protected:

	virtual void* internal_new(size_t cnt)
	{
[b]		return operator new(cnt);[/b]
	}

	virtual void internal_delete(void* ptr)
	{
		operator delete(ptr);
	}

};

i try everything, but can't force it work well=(((
Bear_130278
Posts: 237
Joined: Mon Jan 16, 2006 1:18 pm
Location: Odessa,Russian Federation

Post by Bear_130278 »

Ищи в массивах....
100% ошибка гдето при вылете за бандарис массива..
У тебя гора вот такого я смотрю
Чтото[x][y] и ЕщеЧтоТо[x]
Копай именно там....
Do you like VODKA???
Image
Image
Roman B.
Posts: 9
Joined: Wed Mar 10, 2010 8:04 am
Location: Russia
Contact:

Post by Roman B. »

Все массивы уже тыщу раз проверил.
Если бы были вылеты в массивах, то программа бы вылетала например при установке 8 направлений, т.е. сцена менялась бы 8 раз.
Но тогда она работает отлично, как только количество превышает 9(например устанавливаю 16 направлений)....сразу вылет.

Кроме того, если пускаю ее из IDE, то все работает шикарно.
Только когда пускаю отдельно, вылетает.


Кстати если "закоментить" все действия с массивами, все равно вылетает =)
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

wtf
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Roman B.
Posts: 9
Joined: Wed Mar 10, 2010 8:04 am
Location: Russia
Contact:

Post by Roman B. »

Sudi wrote:wtf
not understand what it's mean.

The resolve of my problem is making even string starts from L" ".

code:

Code: Select all

...
tmpstring = pressure[tourindex]; 
...

updated code:

Code: Select all

...
tmpstring = L" ";
tmpstring += pressure[tourindex]; 
...
Bear_130278
Posts: 237
Joined: Mon Jan 16, 2006 1:18 pm
Location: Odessa,Russian Federation

Post by Bear_130278 »

I think Sudi meant, that we are using uncommon language 8)))
(wtf - what the gently caress)
Do you like VODKA???
Image
Image
Post Reply