Heap Corruption
-
My Qt app represents a vehicle's dashboard. For all the gauges(like speed, rpm, oil), i,m using the QMeter widget(.dll) from qt-apps.org. This qt app is a client getting inputs from another C++ app (server). The qt app crashes sometimes only in debug at _ASSERTE(_CrtIsValidHeapPointer(pUserData)); in the call stack i got, the QMeter::setvalue(double ) is called and few function of qt base class like
update(),update(QRect), markdirty(QRect,Qwidget,bool,bool),adddirtywidget, Qvector::append, qfree ,free and then it crashes at _ASSERTE(_CrtIsValidHeapPointer(pUserData));
I,m using VS 2008.
How to fix this heap corruption? -
Seems like you are freeing a "dangling" pointer, i.e. a pointer that was never initialized or has already been free'd. The reason why you only see the "crash" in the Debug build is because the Debug CRT contains additional checks to catch this kind of errors. It doesn't mean that the problem doesn't exist in the Release version! Instead it's more likely that the problem remains unnoticed in Release builds and may cause other mischief...
Try to strip down your program to find the "problematic" code. Other than that, you might be able to track this down with a tool like Bounds Checker or Insure++. And there's always Valgrind, but only on Linux :(
-
Hi mcosta,
U can find source code of the .dll(ie QMeter) in "http://qt-apps.org/content/show.php?content=72850". -
[quote author="Sayan Bera" date="1354944622"]Hi mcosta,
U can find source code of the .dll(ie QMeter) in "http://qt-apps.org/content/show.php?content=72850".[/quote]If the error is in someone else's code, you'll have to contact the author to correct it. We can only help you with errors in your own code.