Kaydet (Commit) 5066377b authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
de2ac128 "loplugin:useuniqueptr in dbaccess".

Change-Id: Ida073c7e576b88e0d1d1a90253445e946e6eac99
Reviewed-on: https://gerrit.libreoffice.org/45652Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 01283fe8
......@@ -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,
......
......@@ -13,11 +13,16 @@
#include <boost/intrusive_ptr.hpp>
#include <com/sun/star/uno/XInterface.hpp>
// expected-no-diagnostics
struct Foo
{
// Not in general (dbaccess::DocumentEvents, dbaccess/source/core/dataaccess/databasedocument.hxx):
#if 0
std::unique_ptr<css::uno::XInterface> 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<css::uno::XInterface> 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<css::uno::XInterface> 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: */
......@@ -22,6 +22,7 @@
#include <sal/config.h>
#include <map>
#include <memory>
#include <ModelImpl.hxx>
#include "documenteventnotifier.hxx"
......@@ -171,7 +172,7 @@ class ODatabaseDocument :public ModelDependentComponent // ModelDepe
::comphelper::OInterfaceContainerHelper2 m_aCloseListener;
::comphelper::OInterfaceContainerHelper2 m_aStorageListeners;
rtl::Reference<DocumentEvents> m_pEventContainer;
std::unique_ptr<DocumentEvents> m_pEventContainer;
::rtl::Reference< DocumentEventExecutor > m_pEventExecutor;
DocumentEventNotifier m_aEventNotifier;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment