
Originally Posted by
ChrisW67
Are you calling virtual methods in the constructors or destructor of the TrackObject class?
Edit: beaten to it.
I sure that i did not call any virtual methods in my constructors or destructors.
here is my constructor, i only initialized some properties:
TrackObject::TrackObject(QgsMapCanvas* canvas) : QgsMapCanvasItem(canvas)
{
mSize = 16;
trackInfo = NULL;
heading = 0;
speed = 0;
mLastReceiveTime = time(NULL);
bActive = false;
bDrawHeading = true;
nOnwFligh = 0;
textPosition = 0;
nBateryId = 0;
targetStatus = FilterUnknown;
nTrackID = -1;
nTrackNumber = -1;
isDisplaying = true;
setFlag(ItemIsMovable);
}
TrackObject::TrackObject(QgsMapCanvas* canvas) : QgsMapCanvasItem(canvas)
{
mSize = 16;
trackInfo = NULL;
heading = 0;
speed = 0;
fColor = QColor(0, 0, 0);
mLastReceiveTime = time(NULL);
bActive = false;
bDrawHeading = true;
nOnwFligh = 0;
textPosition = 0;
nBateryId = 0;
targetStatus = FilterUnknown;
nTrackID = -1;
nTrackNumber = -1;
isDisplaying = true;
setFlag(ItemIsMovable);
}
To copy to clipboard, switch view to plain text mode
and the destructor, just delete the trackinfo object. the TrackInfo object store some information about the coordinate (lontitude, latitude,..) and also not call any virtual function in its destructor:
TrackObject::~TrackObject()
{
if(trackInfo)
{
delete trackInfo;
trackInfo = NULL;
}
}
TrackObject::~TrackObject()
{
if(trackInfo)
{
delete trackInfo;
trackInfo = NULL;
}
}
To copy to clipboard, switch view to plain text mode
the application not crashed immediately when started but it only run within about 15 - 30 mins after some create and delete TrackObject times.
Bookmarks