Unsolved Any idea what this means?
-
:-1: error: An exception was triggered:
Exception at 0x412bb6, code: 0xc000041d: , flags=0x0.I'm not sure where to look for the error.
-
@jkwok678
You can view using stack trace . -
void Canvas::paintEvent(QPaintEvent* event) { canvasSizeX = width(); canvasSizeY = height(); QPainter painter(this); //painter.drawImage(0, 704, *straightHImage); if (*canvasChosen == Mode::SETTRACKLENGTHSPEED) { for (std::shared_ptr<StraightTrack> currentElement : drawnLayout->getStraightTrackList()) { //Get the stored location of track relative to the canvas widget. int currentX = currentElement->getLocationX(); int currentY = currentElement->getLocationY();
For some reason this line stops the debugger, but on normal run through without debugger, the program works fine.
if (*canvasChosen == Mode::SETTRACKLENGTHSPEED)
I feel like this means it's not me, but any ideas ?
-
@jkwok678 said in Any idea what this means?:
if (*canvasChosen == Mode::SETTRACKLENGTHSPEED)
Are you sure
canvasChosen
is not a dangling pointer, is it right initialized? -
I'm fairly sure, because I have another class called window, and it contains the canvas class, and before the first PaintEvent is called using the timer at the last 2 line, drawingSurface->setMode(modeChosen) makes the canvasChosen = to modeChosen.
drawingSurface = new Canvas; drawingSurface->setMode(modeChosen); windowOffsetX = 0; windowOffsetY = 0; drawingSurface->setOffsetX(windowOffsetX); drawingSurface->setOffsetY(windowOffsetY); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(timerRun()));
-
@jkwok678 said in Any idea what this means?:
For some reason this line stops the debugger
Can you tell which is line number 1766 ?
-
@jkwok678 said in Any idea what this means?:
For some reason this line stops the debugger, but on normal run through without debugger, the program works fine.
If this really is the case, put in console print statements between each line, to find where you get to.
-
@jkwok678 said in Any idea what this means?:
I'm fairly sure
If the debugger stops the application, you can also check the current value of
canvasChosen
and verify if it value is correctly set.
I suppose that you initialize it to0
inCanvas
constructor?But, by the way, I don't understand why you use a pointer to store an enum value?
-
@KroMignon said in Any idea what this means?:
pointer
Hmm, changing the canvasChosen to not being a pointer seems to fix it.
Any idea why though? -
@jkwok678 said in Any idea what this means?:
Hmm, changing the canvasChosen to not being a pointer seems to fix it.
Any idea why though?Because pointer is not right initialized or is pointing to a not valid memory address.