Bekomme SIGSEGV, Heap corruption und andere Speicherfehler
-
Hallo!
Ich bekomme beim Ausführen meines Programms häufig SIGSEGV (segmentation fault), aber auch "Invalid address specified to RtlFreeHeap", "Heap corruption detected at ..." oder "(Internal error: pc 0xff in read in psymtab, but not in symtab.)".Der Stack sieht bei SIGSEGV und "Heap corruption detected at 0B27A988" z.B. so aus:
@0 wcsncpy C:\WINDOWS\system32\ntdll.dll 0 0x7c920717
1 ntdll!RtlRealPredecessor C:\WINDOWS\system32\ntdll.dll 0 0x7c928ccd
2 ?? 0 0xb060000
3 towlower C:\WINDOWS\system32\ntdll.dll 0 0x7c939ba8
4 ntdll!RtlpNtMakeTemporaryKey C:\WINDOWS\system32\ntdll.dll 0 0x7c97fb98
5 ntdll!LdrFindEntryForAddress C:\WINDOWS\system32\ntdll.dll 0 0x7c95b244
6 ?? 0 0xb060000
7 ntdll!RtlpUnWaitCriticalSection C:\WINDOWS\system32\ntdll.dll 0 0x7c929c0c
8 msvcrt!free C:\WINDOWS\system32\msvcrt.dll 0 0x77bfc3c9
9 ?? 0 0xb060000
10 msvcrt!free C:\WINDOWS\system32\msvcrt.dll 0 0x77bfc3e7
11 ?? 0 0xd990
12 ?? 0 0x22bb18
13 msvcrt!malloc C:\WINDOWS\system32\msvcrt.dll 0 0x77bfc42e
14 QImageData::create qimage.cpp 209 0x6e7f9d
15 QImage::QImage qimage.cpp 811 0x6e8635
16 qSmoothScaleImage qimagescale.cpp 1013 0x8216d5
17 smoothScaled qimage.cpp 6393 0x6f7168
18 QImage::transformed qimage.cpp 6585 0x6f7f9a
19 QImage::scaled qimage.cpp 4463 0x6f19d0
20 QLabel::paintEvent qlabel.cpp 1190 0xa41483
21 QWidget::event qwidget.cpp 8508 0x6a6b6b
22 QFrame::event qframe.cpp 557 0xa3b158
23 QLabel::event qlabel.cpp 1073 0xa40681
24 QApplicationPrivate::notify_helper qapplication.cpp 4554 0x65c020
25 QApplication::notify qapplication.cpp 4519 0x65bea1
26 QCoreApplication::notifyInternal qcoreapplication.cpp 876 0x69dd3b76
27 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 234 0xcf137e
28 QWidgetPrivate::drawWidget qwidget.cpp 5585 0x69f6bc
29 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5794 0x6a03fb
30 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5781 0x6a02bb
31 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5781 0x6a02bb
32 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5781 0x6a02bb
33 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5781 0x6a02bb
34 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5781 0x6a02bb
35 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5781 0x6a02bb
36 QWidgetPrivate::drawWidget qwidget.cpp 5638 0x69fb07
37 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5794 0x6a03fb
38 QWidgetPrivate::drawWidget qwidget.cpp 5638 0x69fb07
39 QWidgetPrivate::paintSiblingsRecursive qwidget.cpp 5794 0x6a03fb
40 QWidgetPrivate::drawWidget qwidget.cpp 5638 0x69fb07
41 QWidgetBackingStore::sync qbackingstore.cpp 1373 0x837529
42 QWidgetPrivate::syncBackingStore qwidget.cpp 1891 0x69717e
43 QWidget::event qwidget.cpp 8655 0x6a70b3
44 QMainWindow::event qmainwindow.cpp 1478 0xa5a334
45 QApplicationPrivate::notify_helper qapplication.cpp 4554 0x65c020
46 QApplication::notify qapplication.cpp 4519 0x65bea1
47 QCoreApplication::notifyInternal qcoreapplication.cpp 876 0x69dd3b76
48 QCoreApplication::sendEvent qcoreapplication.h 231 0x69e4488c
49 QCoreApplicationPrivate::sendPostedEvents qcoreapplication.cpp 1500 0x69dd4a91
50 qt_internal_proc qeventdispatcher_win.cpp 496 0x69df9353
51 USER32!GetDC C:\WINDOWS\system32\user32.dll 0 0x7e368734
52 ?? 0 0x2c0468
53 ?? 0 0x401
54 ?? 0
@Für mich ist nicht ersichtlich was da den Fehler auslöst. Und deswegen weiß ich auch nicht an welcher Stelle in meinem Code ich anfangen soll nach der Ursache zu suchen. Es geht um irgendein Event, denke ich mal...
Hier hänge ich noch meine Codeteile an, die manchmal bei QLabel->setPixmap() Probleme machen und zu "Heap block at 0BE2FCD8 modified at 0BE2FCC4 past requested size of ffffffe4" führen (dieser Code wird übrigens mehrmals pro Sekunde ausgeführt):
@ QPixmap Zwischenspeicher = this->Screenshot();
if(!Zwischenspeicher.isNull())
{
//Große Vorschau darstellen
if(ui->checkBox->isChecked())
{
ui->label->setPixmap(Zwischenspeicher);
}//Zwischenspeicher skalieren Zwischenspeicher = Zwischenspeicher.copy(QRect(ui->verticalSlider->value() - ui->horizontalSlider->value()/2, ui->verticalSlider_2->value() - ui->horizontalSlider->value()/2, ui->horizontalSlider->value(), ui->horizontalSlider->value())); //Vorschau darstellen if(ui->checkBox_2->isChecked()) { ui->label_3->setPixmap(Zwischenspeicher); //HIER TAUCHT DIE FEHLERMELDUNG AUF } //skalieren Zwischenspeicher = Zwischenspeicher.scaledToHeight(ui->spinBox->value(), Qt::FastTransformation); QImage Bild = Zwischenspeicher.toImage(); if(!Bild.isNull()) { Bild = Bild.convertToFormat(QImage::Format_Mono, Qt::MonoOnly); if(Zwischenspeicher.convertFromImage(Bild, Qt::AutoColor)) { //darstellen if(ui->checkBox_3->isChecked()) { ui->label_5->setPixmap(Zwischenspeicher); } } } }@
Leider sind die Fehler scheinbar zufällig und kaum reproduzierbar, deshalb ist es ein bisschen schwierig hier darüber zu berichten. Es scheint aber häufig mit missglückter Speicherfreigabe zu tun zu haben (es traten auch schon Probleme bei der Destruktion von 'Bild' am Ende des Scopes auf...).
Ich hoffe jemand kann etwas mit dieser Fehlerdarstellung anfangen und mir weiterhelfen.
Danke schonmal!
Gruß Jake2012 -
Hier noch der Inhalt des Stacks beim beschriebenen Fehler bei setPixmap():
@0 ntdll!DbgUiConnectToDbg C:\WINDOWS\system32\ntdll.dll 0 0x7c91120f
1 ntdll!RtlpNtMakeTemporaryKey C:\WINDOWS\system32\ntdll.dll 0 0x7c97ee31
2 ntdll!RtlZeroHeap C:\WINDOWS\system32\ntdll.dll 0 0x7c96f8f4
3 ?? 0 0xbe2fcd8
4 ntdll!RtlpNtMakeTemporaryKey C:\WINDOWS\system32\ntdll.dll 0 0x7c97f1ff
5 ntdll!RtlpNtMakeTemporaryKey C:\WINDOWS\system32\ntdll.dll 0 0x7c980456
6 ntdll!LdrFindEntryForAddress C:\WINDOWS\system32\ntdll.dll 0 0x7c95bafc
7 ?? 0 0xb060000
8 ntdll!RtlpUnWaitCriticalSection C:\WINDOWS\system32\ntdll.dll 0 0x7c92a1ba
9 msvcrt!free C:\WINDOWS\system32\msvcrt.dll 0 0x77bfc2de
10 ?? 0 0xb060000
11 QImageData::~QImageData qimage.cpp 226 0x6e81ac
12 QImage::~QImage qimage.cpp 1283 0x6e98bc
13 QRasterPixmapData::~QRasterPixmapData qpixmap_raster.cpp 95 0x714c7f
14 QExplicitlySharedDataPointer<QPixmapData>::~QExplicitlySharedDataPointer qshareddata.h 166 0xd2fd7f
15 QPixmap::~QPixmap qpixmap.cpp 350 0x7079ac
16 QLabelPrivate::clearContents qlabel.cpp 1382 0xa41fac
17 QLabel::setPixmap qlabel.cpp 425 0xa3e997
18 MainWindow::Aktualisierung mainwindow.cpp 151 0x405af0
19 MainWindow::qt_static_metacall moc_mainwindow.cpp 75 0x40c8ad
20 QMetaObject::activate qobject.cpp 3547 0x69de9baf
21 QTimer::timeout moc_qtimer.cpp 148 0x69e295f9
22 QTimer::timerEvent qtimer.cpp 280 0x69deceb9
23 QObject::event qobject.cpp 1157 0x69de52be
24 QApplicationPrivate::notify_helper qapplication.cpp 4554 0x65c020
25 QApplication::notify qapplication.cpp 3936 0x659973
26 QCoreApplication::notifyInternal qcoreapplication.cpp 876 0x69dd3b76
27 QCoreApplication::sendEvent qcoreapplication.h 231 0x69e4488c
28 QEventDispatcherWin32Private::sendTimerEvent qeventdispatcher_win.cpp 642 0x69df9a40
29 qt_internal_proc qeventdispatcher_win.cpp 501 0x69df939e
30 USER32!GetDC C:\WINDOWS\system32\user32.dll 0 0x7e368734
31 ?? 0 0x3103dc
32 ?? qlist.h 692 0x113
33 ?? qstring.h 880 0x1
34 qt_fast_timer_proc qeventdispatcher_win.cpp 428 0x69df90ec
@