vclwidget: only call dispose() once

by using a new utility method in vcl::Window
This means that we don't have to make all our dispose
methods safe to call more than once.

Change-Id: I2110c7de4a86c70fdc97dd8fd318c86b56865374
This commit is contained in:
Noel Grandin
2015-03-10 09:07:06 +02:00
committed by Michael Meeks
parent c0a802b59e
commit d7a84ce840
785 changed files with 1234 additions and 1168 deletions

View File

@@ -162,13 +162,18 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
if (pCompoundStatement && pCompoundStatement->size() == 1) {
const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(*pCompoundStatement->body_begin());
if (pCallExpr) {
ok = true;
if( const FunctionDecl* func = pCallExpr->getDirectCallee()) {
if( func->getNumParams() == 0 && func->getIdentifier() != NULL
&& ( func->getName() == "disposeOnce" )) {
ok = true;
}
}
}
}
if (!ok) {
report(
DiagnosticsEngine::Warning,
"vcl::Window subclass should have nothing in it's destructor but a call to dispose().",
"vcl::Window subclass should have nothing in it's destructor but a call to disposeOnce().",
pCXXDestructorDecl->getLocStart())
<< pCXXDestructorDecl->getSourceRange();
return true;