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:
committed by
Michael Meeks
parent
c0a802b59e
commit
d7a84ce840
@@ -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;
|
||||
|
Reference in New Issue
Block a user