mrg95
mrg95

Reputation: 2428

(Qt C++) Error after running a big loop (Willing to pay)

My question is kind of hard to explain quickly. It's difficult to explain out of context. Therefore I am willing to pay someone to help me out over Skype. I'm sure it is just a noob mistake.

Basically, I have a for loop that loops 729 times. When my program is ran, I receive an error when the loop reaches 366 or 367. This is the error:

Exception at... ... QTimer::isSingleShot

The exception pointer points to one of four places every time it freezes, but it always points to when I use QString::fill.

Here is a snapshot: http://gyazo.com/81397af78abd7be46df1bf28960e6f0d

At first, I thought it was a timeout issue, so I moved the loop into a thread. But I still get the error.

My header file for the thread is this:

http://gyazo.com/09fb1eafe8f42314aa918715b83a72eb

I added QThread::msleep(200); for each time it loops to see if it was a timing issue, however, it will still freeze on loop 366 or 367 at one of 4 locations.

Thanks for your time :)

Upvotes: 0

Views: 128

Answers (1)

PeterT
PeterT

Reputation: 8284

So, the 0xe06d7363 code was the code for an exception from the Windows C-Runtime. When catching it with

try{
  ///code including the .fill which allocates memory
}catch(std::exception &e){
  qDebug()<<e.what();
}

it turned out to be a bad_alloc so he simply ran out of memory.

Upvotes: 1

Related Questions