Re: QVector push_back error
There is not enough information on the problem.
The operation should succeed on the private member vector as well.
Check or post the backtrace of the crash.
Cheers,
_
Re: QVector push_back error
Code:
void Route::SetCameraPositions(QVector<QPoint> *cam)
{
QVector<QPoint> bla;
int x,y;
for(int i=0; i<cam->size(); i++) {
x = cam->at(i).x();
y = cam->at(i).y();
t.setX(x);
t.setY(y);
bla.push_back(t) //Works
cameraPoints.push_back(t); //Doesn't work
}
}
Code:
private:
QVector<QPoint> cameraPoints;
Re: QVector push_back error
Should I repeat my previous comment?
Cheers,
_
Re: QVector push_back error
Maybe the object on which you are trying to call this method is invalid (empty or invalid pointer). Show us relevant code or crash backtrace.
Re: QVector push_back error
Code:
==3024==
==3024== Process terminating with default action of signal 11 (SIGSEGV)
==3024== General Protection Fault
==3024== at 0x410CA5: QBasicAtomicInt::operator!=(int) const (qbasicatomic.h:75)
==3024== by 0x417AEA
: QVector<QPoint>
::append(QPoint const
&) (qvector.
h:575) ==3024== by 0x4171C2
: QVector<QPoint>
::push_back(QPoint const
&) (qvector.
h:281) ==3024== by 0x420DF0: Route::SetCameraPositions(QVector<QPoint>*) (cRoute.cpp:46)
==3024== by 0x4107DA: MainWindow::SetCameraLocations() (mainwindow.cpp:678)
==3024== by 0x40C577: MainWindow::SetupModel() (mainwindow.cpp:141)
==3024== by 0x40B6CB
: MainWindow
::MainWindow(QWidget*) (mainwindow.
cpp:48) ==3024== by 0x40B3BF: main (main.cpp:18)
==3024==
==3024== Events : Ir
==3024== Collected : 172003489
==3024==
==3024== I refs: 172,003,489
** Process crashed **
EDIT: I've solved problem. It's in mainwindow file, not in the code i wrote here.