我在一個執行緒中畫QImage,函式執行第一遍是沒問題的,但是執行第二遍時就會彈出SIGSEGV錯誤
Signal meaning: Segmentation fault.
Debuger的函式呼叫停在 QPainterPrivate::attachPainterPrivate(QPainter*, QPaintDevice*)
代碼如下:
QRect target;
pait.begin(g_GE->GetDrawBuffer());
pait.setRenderHint(QPainter::Antialiasing, true);
g_GE->SetisDraw(true);
while(g_GE->GetImageArray()->size()) {
ImageInfo* pInfo = g_GE->GetImageArray()->at(0);
g_GE->GetImageArray()->pop_front();
if (pInfo->type == _gedraw) {
target = pInfo->rect;
pait.drawImage(target, *(pInfo->pImg), pInfo->rect);
}
}
pait.end();
g_GE->SetisDraw(false);
return 0;
Version is Qt 5.14.1 MinGW 7.3.0 32bit
OS:Windows 10
uj5u.com熱心網友回復:
我試了 MSVC2015 沒有這個錯誤了,但是會不停地彈22:46:08: Debugging starts
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::end: Painter not active, aborted
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setBackgroundMode: Painter not active
QPainter::end: Painter not active, aborted
QPainter::begin: A paint device can only be painted by one painter at a time.
QPainter::setRenderHint: Painter must be active to set rendering hints
QPainter::setBackgroundMode: Painter not active
QPainter::end: Painter not active, aborted
可是MainWindow的paintevent 是空函式,還有哪個會調QPainter呢?
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/67320.html
標籤:Qt
