PDA

View Full Version : Program loops at one line



Platoon
30th September 2009, 07:59
Hi i have a quite strange problem....this is the code


void ClassC::protocolList(QList<Protocol*> **list)
{
(*list) = this->mProtocolList;
}


When i debug this assignment it doesn't go further.....it remains at this line

Can anyone tell me why?

wysota
30th September 2009, 08:29
Can you elaborate how you debug and how it "remains at this line"?

Platoon
30th September 2009, 09:14
I set a breakpoint one line before and the program stops as expected then i press step over and the program does one step. Now the debugger is at my problem assignment line....and when i press step over again it does not move on......in detail: the arrow which indicates at whic line the debugger is standing disappears for a second and the reappears at the same line....instead of appearing at the next line


i hope i explained my problem in a way you can understand

jano_alex_es
30th September 2009, 09:44
can you tell us which compiler are you using?

wysota
30th September 2009, 09:45
Change your code to the following:

void ClassC::protocolList(QList<Protocol*> **list)
{
qDebug() << Q_FUNC_INFO << "Enter";
(*list) = this->mProtocolList;
qDebug() << Q_FUNC_INFO << "Leave";
}
And run your program without a debugger. See if the statements get printed properly. Maybe there is some problem with the debugger itself (Qt Creator is known to work not very well with MSVC debugger).

Platoon
30th September 2009, 09:59
When program reaches the line it crashes and windows says: ****.exe doesnt work anymore

and debug output is:
Starte D:\HTL\DA\*****\02_Software\01_Program\****\debug\ ****.exe...
void ClassC::protocolList(QList<Protocol*>**) Enter

D:\HTL\DA\*****02_Software\01_Program\****\debug\* ****.exe beendet, Rückgabewert -1073741819

I am using MinGW
GNU Make 3.81

wysota
30th September 2009, 10:50
In that case no wonder the debugger doesn't want to continue execution...

Your code is simply invalid - I'd say you are passing an invalid pointer into this function. Why are you passing a pointer to a pointer to a list?

Platoon
3rd October 2009, 16:02
OK...now i have it!

You where right wysota....it was an invalid pointer because somewhere in my code i initialised a local variable of the type ClassC with the same name.....after changing it to the real variable it all worked fine....i hope you understand what i mean ^^

Thanks for the tipp