I just spend several days finding the source of a crash in the program I'm porting to OWLNext.
The cause was the destructor of a class derived from TLayoutWindow indirectly calling TLayoutWindow::Layout after the destructor for TLayoutWindow had been called. The problem was that the TLayoutWindow destructor freed the items pointed to by ChildMetrics and Constraints, but left the pointers intact. Calling layout attempted to use these pointers to freed data and, well, it didn't work out very wel.
I'd like to suggest a small chagne to ~TLayoutWindow. This is good practice anyway.
I just spend several days finding the source of a crash in the program I'm porting to OWLNext.
The cause was the destructor of a class derived from TLayoutWindow indirectly calling TLayoutWindow::Layout after the destructor for TLayoutWindow had been called. The problem was that the TLayoutWindow destructor freed the items pointed to by ChildMetrics and Constraints, but left the pointers intact. Calling layout attempted to use these pointers to freed data and, well, it didn't work out very wel.
I'd like to suggest a small chagne to ~TLayoutWindow. This is good practice anyway.
Thanks,
++PLS
TLayoutWindow::~TLayoutWindow()
{
delete[] Variables;
// Free the child metrics
//
for (TChildMetrics childMetrics = ChildMetrics; childMetrics;) {
TChildMetrics tmp = childMetrics;
childMetrics = childMetrics->Next;
delete tmp;
}
ChildMetrics = 0; // <---- Inserted
// Free the constraints
//
ClearPlan();
for (TConstraint c = Constraints; c;) {
TConstraint tmp = c;
c = c->Next;
delete tmp;
}
Constraints = 0; // <---- Inserted
}
Hello,
Thanks for the fix, I will include it in the next release candidate
(coming next week)
Jogy