Files
loongoffice/dbaccess/source/core/dataaccess/SharedConnection.cxx
Julien Nabet 502fbd79f9 Related tdf#144256: fix order of disposing in OSharedConnection
In dbaccess/source/core/dataaccess/SharedConnection.hxx, we got:
35      typedef ::cppu::WeakComponentImplHelper< css::sdbc::XConnection
36                                             > OSharedConnection_BASE;
37      typedef ::connectivity::OConnectionWrapper  OSharedConnection_BASE2;
38
39      class OSharedConnection :   public ::cppu::BaseMutex
40                                , public OSharedConnection_BASE
41                                , public OSharedConnection_BASE2

so first OSharedConnection_BASE ctr is called before OConnectionWrapper ctr
therefore OConnectionWrapper dtr should be called before OSharedConnection_BASE dtr

It doesn't fix the bug but investigating in all this mess, I'd like to fix these things since it may help.

Change-Id: I47255357b4ca02261f31ebf500f3f1ff55642e69
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158096
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-10-18 09:49:54 +02:00

155 lines
4.0 KiB
C++

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "SharedConnection.hxx"
#include <comphelper/uno3.hxx>
namespace dbaccess
{
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::sdbc;
using namespace ::com::sun::star::container;
using namespace connectivity;
OSharedConnection::OSharedConnection(Reference<XAggregation>& _rxProxyConnection)
: OSharedConnection_BASE(m_aMutex)
{
setDelegation(_rxProxyConnection, m_refCount);
}
OSharedConnection::~OSharedConnection() {}
void SAL_CALL OSharedConnection::disposing()
{
OConnectionWrapper::disposing();
OSharedConnection_BASE::disposing();
}
Reference<XStatement> SAL_CALL OSharedConnection::createStatement()
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->createStatement();
}
Reference<XPreparedStatement> SAL_CALL OSharedConnection::prepareStatement(const OUString& sql)
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->prepareStatement(sql);
}
Reference<XPreparedStatement> SAL_CALL OSharedConnection::prepareCall(const OUString& sql)
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->prepareCall(sql);
}
OUString SAL_CALL OSharedConnection::nativeSQL(const OUString& sql)
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->nativeSQL(sql);
}
sal_Bool SAL_CALL OSharedConnection::getAutoCommit()
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getAutoCommit();
}
void SAL_CALL OSharedConnection::commit()
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
m_xConnection->commit();
}
void SAL_CALL OSharedConnection::rollback()
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
m_xConnection->rollback();
}
sal_Bool SAL_CALL OSharedConnection::isClosed()
{
::osl::MutexGuard aGuard(m_aMutex);
if (!m_xConnection.is())
return true;
return m_xConnection->isClosed();
}
Reference<XDatabaseMetaData> SAL_CALL OSharedConnection::getMetaData()
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getMetaData();
}
sal_Bool SAL_CALL OSharedConnection::isReadOnly()
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->isReadOnly();
}
OUString SAL_CALL OSharedConnection::getCatalog()
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getCatalog();
}
sal_Int32 SAL_CALL OSharedConnection::getTransactionIsolation()
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getTransactionIsolation();
}
Reference<css::container::XNameAccess> SAL_CALL OSharedConnection::getTypeMap()
{
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(rBHelper.bDisposed);
return m_xConnection->getTypeMap();
}
IMPLEMENT_GET_IMPLEMENTATION_ID(OSharedConnection)
} // namespace dbaccess
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */