So, I came across a problem that I canβt solve for a while. I am writing a Qt application in C ++ and developing MacOSX on which it works great. However, as I test the code in windows, I encounter the following access violation when I close OR cancel the QDialog child that I have:
Unhandled exception at 0x5ce6b1ea (QtGuid4.dll) in MyApp.exe: 0xC0000005: Access violation reading location 0xfeeefefa.
Debugging this, I see that it crashes after many Qt api calls, eventually making its way to QWindowSurface_Raster.cpp. Here is the Qt library code with which it crashes:
#endif { QPoint wOffset = qt_qwidget_data(widget)->wrect.topLeft(); HDC widget_dc = widget->getDC(); QRect wbr = br.translated(-wOffset); BitBlt(widget_dc, wbr.x(), wbr.y(), wbr.width(), wbr.height(), d->image->hdc, br.x() + offset.x(), br.y() + offset.y(), SRCCOPY); widget->releaseDC(widget_dc); }
And finally, here is my code where I call qdialog:
void MainWindow::prefDialog() { prefD = new PreferenceDialog(this); prefD->exec(); }
PreferenceDialog.h:
class PreferenceDialog : public QDialog { Q_OBJECT public: PreferenceDialog(QWidget *parent); .....
PreferenceDialog.c
PreferenceDialog::PreferenceDialog(QWidget *parent) : QDialog(parent) { .... connect(okayButton, SIGNAL(released()), this, SLOT(okayClicked())); connect(addKeyButton, SIGNAL(released()), this, SLOT(addClicked())); connect(cancelButton, SIGNAL(released()), this, SLOT(cancelClicked())); ....
I can show you my PreferenceDialog code or any other code, but I think it will just inflate the situation. PreferenceDialog does nothing but the one shown, and I do not override any function like exec (), etc. The stack trace is pretty bloated, so I wonβt post messages, it's just a bunch of calls to Qtguid4.dll after exec () ends (about 10), until it comes to this crash in QWindowRaster.
Let me know if any other information is needed. I am new to Qt, so itβs hard for me to understand this, any help would be greatly appreciated, thanks!