PDA

View Full Version : Error Exiting slot calls



jacks916
9th August 2011, 18:57
So First thing first, this is a program specific to a web app only accessible on the intranet of the group I'm writing it for, sorry you cant really run it on your end.
I am having the most bizarre problem and was hoping someone has seem this issue.

So the process calls end and the program enters into and finished the moc_* file then I get one of 2 errors:

1-
First-chance exception at 0x655a3196 in Bommerd.exe: 0xC0000005: Access violation reading location 0xfeeeff0a.
Unhandled exception at 0x655a3196 in Bommerd.exe: 0xC0000005: Access violation reading location 0xfeeeff0a.
With a break point on line 109 of free.c

"#endif /* _WIN64 */
{
---> retval = HeapFree(_crtheap, 0, pBlock);
if (retval == 0)
{
errno = _get_errno_from_oserr(GetLastError());
}
}


Or something in malloc file (cant seem to populate this one after the changes)

the weird part, in laman's terms, is all function calls finish and control should be returned to the central cpp in an "idle" mode but i get the above errors.

QT 4.7.1 with VS2008 v 9.0.30729.1 SP on Win XP x86 machine

EDIT: this only happens at the end of ONE of my signal-slot call. the rest work without a hitch

Any help would be awesome. and if you have questions ask away.

MasterBLB
9th August 2011, 20:53
Man,without showing us the code we can only guess and suspect,but cannot help you.I suspect some incorrect memory manage (you seem to delete some pointer too early,or use one without initializing it),but untill I see whole code I can't tell you more

jacks916
9th August 2011, 21:53
Qt does it own memory management correct? then how am I deleting too soon?
(I promise you its not accessing something that is uninitialized, and I delete nothing, and only new as needed.)

mlock.c


void __cdecl _unlock (
int locknum
)
{
/*
* leave the critical section.
*/
LeaveCriticalSection( _locktable[locknum].lock );
BP-->}

Or in malloc.c


#ifdef _WIN64
return HeapAlloc(_crtheap, 0, size ? size : 1);
#else /* _WIN64 */
if (__active_heap == __SYSTEM_HEAP) {
BP--> return HeapAlloc(_crtheap, 0, size ? size : 1);
} else
if ( __active_heap == __V6_HEAP ) {
if (pvReturn = V6_HeapAlloc(size)) {
return pvReturn;


one weird thing is 2 of these are in what seems to be Win 64 ifndef blocks and im on a 32 bit machine...



I dont know how you are supposed to debug the functionality when you cant run the program... but if you wish to view my 2400+ lines I guess i can upload them. Just note that some functions are in another lib that i can not upload. these functions are self explanatory by title.

the error occurs after line 1561's function completes excution.

MasterBLB
9th August 2011, 22:36
I dont know how you are supposed to debug the functionality when you cant run the program... but if you wish to view my 2400+ lines I guess i can upload them. Just note that some functions are in another lib that i can not upload. these functions are self explanatory by title.

the error occurs after line 1561's function completes excution.
Very easy-I'd check the stack to see inside what of your functions the segfault occurs.Because the bug lies somewhere in your code I bet,not inside Qt.
Hmm,I see that using a debugger is the only option to find out what's wrong,as those two files you've provided are not enough to compile the app.

Just run your app under debugger,and after segfault you'll be able to check where is the bug

jacks916
9th August 2011, 22:52
QtGuid4.dll!655a3196()
[Frames below may be incorrect and/or missing, no symbols loaded for QtGuid4.dll]
QtGuid4.dll!657eb3ff()
QtGuid4.dll!6506b95f()
QtGuid4.dll!65353f51()
QtGuid4.dll!650c0b95()
QtGuid4.dll!65353ebc()
QtGuid4.dll!650c0a54()
QtGuid4.dll!657e7cd1()
QtGuid4.dll!6583119a()
QtGuid4.dll!657588ba()
QtGuid4.dll!6575322d()
QtGuid4.dll!657a0aa4()
QtGuid4.dll!65750593()
QtGuid4.dll!657a6456()
QtGuid4.dll!657a02f6()
QtGuid4.dll!650f2324()
user32.dll!7e418bd9()
ntdll.dll!7c962fe0()
ntdll.dll!7c91a1ba()
ntdll.dll!7c9152aa()
ntdll.dll!7c91520d()
ntdll.dll!7c9154f1()
kernel32.dll!7c809acc()
kernel32.dll!7c809ad6()
kernel32.dll!7c80e6cb()
kernel32.dll!7c80e4fc()
MSCTFIME.IME!755dd55b()
MSCTFIME.IME!755dd563()
kernel32.dll!7c832f59()
kernel32.dll!7c832f61()
kernel32.dll!7c832f61()
MSCTFIME.IME!755c7219()
kernel32.dll!7c832f59()
kernel32.dll!7c832f61()
gdi32.dll!77f16b25()
gdi32.dll!77f1609b()
uxtheme.dll!5ad73c02()
user32.dll!7e418bd9()
user32.dll!7e4296f7()
user32.dll!7e428dac()
user32.dll!7e4296f7()
user32.dll!7e418ffb()
user32.dll!7e418ffb()
uxtheme.dll!5ad746f6()
QtGuid4.dll!650f339a()
QtGuid4.dll!6507370b()
QtGuid4.dll!6505f8ea()
> msvcr90d.dll!_heap_alloc_base(unsigned int size=255) Line 105 + 0x28 bytes C
ffffff90()


this is the stack after error, its seems now to only error 40-50% of the time
I have 2 project specific linked libs and cant publish those sorry.

MasterBLB
9th August 2011, 23:00
Very strange-where are functions from your application??At least main() shoud be visible there!Like in my project below.Hmmmm please ensure that you're using Debug build,and add breakpoint at those line 1561

> LoggerDLLTest.exe!LoggerDLLTest::LoggerDLLTest(QWi dget * parent=0x00000000, QFlags<enum Qt::WindowType> flags={...}) Line 6 C++
LoggerDLLTest.exe!main(int argc=1, char * * argv=0x003f6718) Line 7 + 0x17 C++
LoggerDLLTest.exe!WinMain(HINSTANCE__ * instance=0x00400000, HINSTANCE__ * prevInstance=0x00000000, char * __formal=0x00141f44, int cmdShow=1) Line 136 + 0x12 C++
LoggerDLLTest.exe!WinMainCRTStartup() Line 390 + 0x39 C
kernel32.dll!7c816d4f()
ntdll.dll!7c915b4f()
kernel32.dll!7c8399f3()

jacks916
9th August 2011, 23:13
I am not new to programming or debugging, you cant see the call stack without debugging...:p

Above is after the fault,

below is before it:


> Bommerd.exe!Bommer::removePartFromBOM(QTreeWidgetI tem * subpart=0x02a50420, int col=0) Line 1562 C++
Bommerd.exe!Bommer::qt_metacall(QMetaObject::Call _c=InvokeMetaMethod, int _id=17, void * * _a=0x0012c1d0) Line 129 + 0x1a bytes C++
QtCored4.dll!671ccae1()
[Frames below may be incorrect and/or missing, no symbols loaded for QtCored4.dll]
QtCored4.dll!671e4386()
QtCored4.dll!672654f0()
QtGuid4.dll!657e9622()
msvcr90d.dll!_unlock(int locknum=0) Line 376 C

and just before "idle" mode (ie in the moc file)


> Bommerd.exe!Bommer::qt_metacall(QMetaObject::Call _c=InvokeMetaMethod, int _id=17, void * * _a=0x0012c1d0) Line 129 + 0x1a bytes C++
QtCored4.dll!671ccae1()
[Frames below may be incorrect and/or missing, no symbols loaded for QtCored4.dll]
QtCored4.dll!671e4386()
QtCored4.dll!672654f0()
QtGuid4.dll!657e9622()
msvcr90d.dll!_unlock(int locknum=0) Line 376 C

MasterBLB
9th August 2011, 23:51
Hmm,so at least we know,that the bug appears in the Bommer::removePartFromBOM() indeed...well,I'd put a beakpoint just at the beginning of the function and then check the code step by step watching carefully especially all pointers.I bet some of them is incorrect somehow.

jacks916
10th August 2011, 15:10
I have seen nothing incorrect, this including the functions that removePartFromBOM calls.

Master, no offense to you, but i have been debugging this for 16hours over the past 3 days, and have looked at the easy stuff. This is not an easy fix.

jacks916
10th August 2011, 18:18
YAY I found it, Corrupted Heap.

If you looked at the Code I was deleting the sent in parameter, not only once but twice

MasterBLB
11th August 2011, 13:19
As I said-a bad pointer :P