From a925cd6f6704bcbdd1a7dd165d29d499a5c59797 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 1 Dec 2017 11:24:04 +0100 Subject: Don't prevent ODatabaseDocument refcount from dropping to zero ...preventing the dtor from ever being called. (DocumentEvents forwards its acquire/release calls to its m_pData->rParent, i.e., the ODatabaseDocument, for better or worse.) This caused ODatabaseDocument instances to be leaked during e.g. JunitTest_dbaccess_complex. Regression introduced with de2ac128da025502c533f8cede5862e054dd9c44 "loplugin:useuniqueptr in dbaccess". Change-Id: Ida073c7e576b88e0d1d1a90253445e946e6eac99 Reviewed-on: https://gerrit.libreoffice.org/45652 Reviewed-by: Noel Grandin Tested-by: Jenkins Reviewed-by: Stephan Bergmann (cherry picked from commit 5066377bbeab1000f31e3fa689bad2ff8bf35295) Reviewed-on: https://gerrit.libreoffice.org/45685 --- compilerplugins/clang/refcounting.cxx | 3 +++ compilerplugins/clang/test/refcounting.cxx | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index 8091fb3ee0cd..58a9884ede0d 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -479,6 +479,8 @@ bool RefCounting::VisitFieldDecl(const FieldDecl * fieldDecl) { << fieldDecl->getSourceRange(); } +// Not in general (dbaccess::DocumentEvents, dbaccess/source/core/dataaccess/databasedocument.hxx): +#if 0 if (!firstTemplateParamType.isNull() && containsXInterfaceSubclass(firstTemplateParamType)) { report( @@ -490,6 +492,7 @@ bool RefCounting::VisitFieldDecl(const FieldDecl * fieldDecl) { << fieldDecl->getParent() << fieldDecl->getSourceRange(); } +#endif checkUnoReference( fieldDecl->getType(), fieldDecl, diff --git a/compilerplugins/clang/test/refcounting.cxx b/compilerplugins/clang/test/refcounting.cxx index 48fb94c694c4..4bcb03e2eef6 100644 --- a/compilerplugins/clang/test/refcounting.cxx +++ b/compilerplugins/clang/test/refcounting.cxx @@ -13,11 +13,16 @@ #include #include +// expected-no-diagnostics + struct Foo { +// Not in general (dbaccess::DocumentEvents, dbaccess/source/core/dataaccess/databasedocument.hxx): +#if 0 std::unique_ptr m_foo1; // expected-error {{XInterface subclass 'com::sun::star::uno::XInterface' being managed via smart pointer, should be managed via uno::Reference, parent is 'Foo' [loplugin:refcounting]}} std::shared_ptr m_foo2; // expected-error {{XInterface subclass 'com::sun::star::uno::XInterface' being managed via smart pointer, should be managed via uno::Reference, parent is 'Foo' [loplugin:refcounting]}} boost::intrusive_ptr m_foo3; // expected-error {{XInterface subclass 'com::sun::star::uno::XInterface' being managed via smart pointer, should be managed via uno::Reference, parent is 'Foo' [loplugin:refcounting]}} +#endif }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ -- cgit