summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-07-07 16:54:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-07-07 17:02:14 +0100
commit4bb2d015b332aa5e7623b4edba53f0503c64bbba (patch)
tree0999b6828ea2ef54ee90cc03e604874107eec097
parent7161ff6e928cd74a2fba9fd6f966f2283bd24d59 (diff)
Related: tdf#92434 children cleared but parent hasn't completed dispose yet
Table::dispose is being executed, so its not IsDisposed yet, but this a11y code gets called during the dispose and the children have been cleared at this point Change-Id: I20aa9b15b1c5c3da91af58ac61f59fcf52619d58
-rw-r--r--dbaccess/source/ui/inc/TableWindow.hxx10
-rw-r--r--dbaccess/source/ui/querydesign/QTableWindow.cxx18
-rw-r--r--dbaccess/source/ui/querydesign/TableWindow.cxx83
-rw-r--r--dbaccess/source/ui/querydesign/TableWindowAccess.cxx14
4 files changed, 66 insertions, 59 deletions
diff --git a/dbaccess/source/ui/inc/TableWindow.hxx b/dbaccess/source/ui/inc/TableWindow.hxx
index a2c704ab18d4..c120d0ecfe47 100644
--- a/dbaccess/source/ui/inc/TableWindow.hxx
+++ b/dbaccess/source/ui/inc/TableWindow.hxx
@@ -25,6 +25,7 @@
#include <tools/rtti.hxx>
#include <rtl/ref.hxx>
#include "TableWindowData.hxx"
+#include "TableWindowListBox.hxx"
#include <vector>
#include <vcl/window.hxx>
@@ -41,7 +42,6 @@ namespace dbaui
const sal_uInt16 SIZING_LEFT = 0x0004;
const sal_uInt16 SIZING_RIGHT = 0x0008;
- class OTableWindowListBox;
class OJoinDesignView;
class OJoinTableView;
class OTableWindowAccess;
@@ -55,8 +55,8 @@ namespace dbaui
protected:
// and the table itself (needed for me as I want to lock it as long as the window is alive)
VclPtr<FixedImage> m_aTypeImage;
- VclPtr<OTableWindowTitle> m_aTitle;
- VclPtr<OTableWindowListBox> m_pListBox;
+ VclPtr<OTableWindowTitle> m_xTitle;
+ VclPtr<OTableWindowListBox> m_xListBox;
OTableWindowAccess* m_pAccessible;
private:
@@ -146,9 +146,9 @@ namespace dbaui
OUString GetTableName() const { return m_pData->GetTableName(); }
OUString GetWinName() const { return m_pData->GetWinName(); }
OUString GetComposedName() const { return m_pData->GetComposedName(); }
- OTableWindowListBox* GetListBox() const { return m_pListBox; }
+ VclPtr<OTableWindowListBox> GetListBox() const { return m_xListBox; }
TTableWindowData::value_type GetData() const { return m_pData; }
- OTableWindowTitle& GetTitleCtrl() { return *m_aTitle.get(); }
+ VclPtr<OTableWindowTitle> GetTitleCtrl() { return m_xTitle; }
/** returns the name which should be used when displaying join or relations
@return
diff --git a/dbaccess/source/ui/querydesign/QTableWindow.cxx b/dbaccess/source/ui/querydesign/QTableWindow.cxx
index 289da9cf5a4a..a422c6c92810 100644
--- a/dbaccess/source/ui/querydesign/QTableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/QTableWindow.cxx
@@ -97,8 +97,8 @@ bool OQueryTableWindow::Init()
SetAliasName(sAliasName);
// SetAliasName passes it as WinName, hence it uses the base class
// reset the title
- m_aTitle->SetText( pWinData->GetWinName() );
- m_aTitle->Show();
+ m_xTitle->SetText( pWinData->GetWinName() );
+ m_xTitle->Show();
getTableView()->getDesignView()->getController().InvalidateFeature(ID_BROWSER_QUERY_EXECUTE);
return bSuccess;
@@ -131,10 +131,10 @@ void OQueryTableWindow::OnEntryDoubleClicked(SvTreeListEntry* pEntry)
OSL_ENSURE(pInf != NULL, "OQueryTableWindow::OnEntryDoubleClicked : field doesn't have FieldInfo !");
// build up DragInfo
- OTableFieldDescRef aInfo = new OTableFieldDesc(GetTableName(),m_pListBox->GetEntryText(pEntry));
+ OTableFieldDescRef aInfo = new OTableFieldDesc(GetTableName(), m_xListBox->GetEntryText(pEntry));
aInfo->SetTabWindow(this);
aInfo->SetAlias(GetAliasName());
- aInfo->SetFieldIndex(m_pListBox->GetModel()->GetAbsPos(pEntry));
+ aInfo->SetFieldIndex(m_xListBox->GetModel()->GetAbsPos(pEntry));
aInfo->SetDataType(pInf->GetDataType());
// and insert corresponding field
@@ -143,13 +143,13 @@ void OQueryTableWindow::OnEntryDoubleClicked(SvTreeListEntry* pEntry)
bool OQueryTableWindow::ExistsField(const OUString& strFieldName, OTableFieldDescRef& rInfo)
{
- OSL_ENSURE(m_pListBox != nullptr, "OQueryTableWindow::ExistsField : doesn't have ::com::sun::star::form::ListBox !");
+ OSL_ENSURE(m_xListBox != nullptr, "OQueryTableWindow::ExistsField : doesn't have ::com::sun::star::form::ListBox !");
OSL_ENSURE(rInfo.is(),"OQueryTableWindow::ExistsField: invalid argument for OTableFieldDescRef!");
Reference< XConnection> xConnection = getTableView()->getDesignView()->getController().getConnection();
bool bExists = false;
if(xConnection.is())
{
- SvTreeListEntry* pEntry = m_pListBox->First();
+ SvTreeListEntry* pEntry = m_xListBox->First();
try
{
Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData();
@@ -157,7 +157,7 @@ bool OQueryTableWindow::ExistsField(const OUString& strFieldName, OTableFieldDes
while (pEntry)
{
- if (bCase(strFieldName,OUString(m_pListBox->GetEntryText(pEntry))))
+ if (bCase(strFieldName,OUString(m_xListBox->GetEntryText(pEntry))))
{
OTableFieldInfo* pInf = static_cast<OTableFieldInfo*>(pEntry->GetUserData());
assert(pInf && "OQueryTableWindow::ExistsField : field doesn't have FieldInfo !");
@@ -166,12 +166,12 @@ bool OQueryTableWindow::ExistsField(const OUString& strFieldName, OTableFieldDes
rInfo->SetField(strFieldName);
rInfo->SetTable(GetTableName());
rInfo->SetAlias(GetAliasName());
- rInfo->SetFieldIndex(m_pListBox->GetModel()->GetAbsPos(pEntry));
+ rInfo->SetFieldIndex(m_xListBox->GetModel()->GetAbsPos(pEntry));
rInfo->SetDataType(pInf->GetDataType());
bExists = true;
break;
}
- pEntry = m_pListBox->Next(pEntry);
+ pEntry = m_xListBox->Next(pEntry);
}
}
catch(SQLException&)
diff --git a/dbaccess/source/ui/querydesign/TableWindow.cxx b/dbaccess/source/ui/querydesign/TableWindow.cxx
index cd8638cf52fe..3e78a61c8d49 100644
--- a/dbaccess/source/ui/querydesign/TableWindow.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindow.cxx
@@ -96,8 +96,7 @@ OTableWindow::OTableWindow( vcl::Window* pParent, const TTableWindowData::value_
: ::comphelper::OContainerListener(m_aMutex)
,Window( pParent, WB_3DLOOK|WB_MOVEABLE )
,m_aTypeImage( VclPtr<FixedImage>::Create(this) )
- ,m_aTitle( VclPtr<OTableWindowTitle>::Create(this) )
- ,m_pListBox(NULL)
+ ,m_xTitle( VclPtr<OTableWindowTitle>::Create(this) )
,m_pAccessible(NULL)
,m_pData( pTabWinData )
,m_nMoveCount(0)
@@ -130,17 +129,17 @@ OTableWindow::~OTableWindow()
void OTableWindow::dispose()
{
- if (m_pListBox)
+ if (m_xListBox)
{
- OSL_ENSURE(m_pListBox->GetEntryCount()==0,"Forgot to call EmptyListbox()!");
+ OSL_ENSURE(m_xListBox->GetEntryCount()==0,"Forgot to call EmptyListbox()!");
}
- m_pListBox.disposeAndClear();
+ m_xListBox.disposeAndClear();
if ( m_pContainerListener.is() )
m_pContainerListener->dispose();
m_pAccessible = NULL;
m_aTypeImage.disposeAndClear();
- m_aTitle.disposeAndClear();
+ m_xTitle.disposeAndClear();
vcl::Window::dispose();
}
@@ -194,7 +193,7 @@ VclPtr<OTableWindowListBox> OTableWindow::CreateListBox()
bool OTableWindow::FillListBox()
{
- m_pListBox->Clear();
+ m_xListBox->Clear();
if ( !m_pContainerListener.is() )
{
Reference< XContainer> xContainer(m_pData->getColumns(),UNO_QUERY);
@@ -208,7 +207,7 @@ bool OTableWindow::FillListBox()
if (GetData()->IsShowAll())
{
- SvTreeListEntry* pEntry = m_pListBox->InsertEntry( OUString("*") );
+ SvTreeListEntry* pEntry = m_xListBox->InsertEntry( OUString("*") );
pEntry->SetUserData( createUserData(NULL,false) );
}
@@ -236,9 +235,9 @@ bool OTableWindow::FillListBox()
bool bPrimaryKeyColumn = xPKeyColumns.is() && xPKeyColumns->hasByName( *pIter );
// is this column in the primary key
if ( bPrimaryKeyColumn )
- pEntry = m_pListBox->InsertEntry(*pIter, aPrimKeyImage, aPrimKeyImage);
+ pEntry = m_xListBox->InsertEntry(*pIter, aPrimKeyImage, aPrimKeyImage);
else
- pEntry = m_pListBox->InsertEntry(*pIter);
+ pEntry = m_xListBox->InsertEntry(*pIter);
Reference<XPropertySet> xColumn(xColumns->getByName(*pIter),UNO_QUERY);
if ( xColumn.is() )
@@ -267,16 +266,16 @@ void OTableWindow::deleteUserData(void*& _pUserData)
void OTableWindow::clearListBox()
{
- if ( m_pListBox )
+ if ( m_xListBox )
{
- SvTreeListEntry* pEntry = m_pListBox->First();
+ SvTreeListEntry* pEntry = m_xListBox->First();
while(pEntry)
{
void* pUserData = pEntry->GetUserData();
deleteUserData(pUserData);
- SvTreeListEntry* pNextEntry = m_pListBox->Next(pEntry);
- m_pListBox->GetModel()->Remove(pEntry);
+ SvTreeListEntry* pNextEntry = m_xListBox->Next(pEntry);
+ m_xListBox->GetModel()->Remove(pEntry);
pEntry = pNextEntry;
}
}
@@ -302,24 +301,24 @@ void OTableWindow::impl_updateImage()
bool OTableWindow::Init()
{
// create list box if necessary
- if ( !m_pListBox )
+ if ( !m_xListBox )
{
- m_pListBox = CreateListBox();
- OSL_ENSURE( m_pListBox != nullptr, "OTableWindow::Init() : CreateListBox returned NULL !" );
- m_pListBox->SetSelectionMode( MULTIPLE_SELECTION );
+ m_xListBox = CreateListBox();
+ OSL_ENSURE( m_xListBox != nullptr, "OTableWindow::Init() : CreateListBox returned NULL !" );
+ m_xListBox->SetSelectionMode( MULTIPLE_SELECTION );
}
// Set the title
- m_aTitle->SetText( m_pData->GetWinName() );
- m_aTitle->Show();
+ m_xTitle->SetText( m_pData->GetWinName() );
+ m_xTitle->Show();
- m_pListBox->Show();
+ m_xListBox->Show();
// add the fields to the ListBox
clearListBox();
bool bSuccess = FillListBox();
if ( bSuccess )
- m_pListBox->SelectAll( false );
+ m_xListBox->SelectAll( false );
impl_updateImage();
@@ -474,11 +473,11 @@ void OTableWindow::Resize()
nTitleHeight = aImageSize.Height();
nPositionX += aImageSize.Width() + CalcZoom( 2 );
- m_aTitle->SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) );
+ m_xTitle->SetPosSizePixel( Point( nPositionX, nPositionY ), Size( aOutSize.Width() - nPositionX - n5Pos, nTitleHeight ) );
long nTitleToList = CalcZoom( 3 );
- m_pListBox->SetPosSizePixel(
+ m_xListBox->SetPosSizePixel(
Point( n5Pos, nPositionY + nTitleHeight + nTitleToList ),
Size( aOutSize.Width() - 2 * n5Pos, aOutSize.Height() - ( nPositionY + nTitleHeight + nTitleToList ) - n5Pos )
);
@@ -488,26 +487,26 @@ void OTableWindow::Resize()
void OTableWindow::SetBoldTitle( bool bBold )
{
- vcl::Font aFont = m_aTitle->GetFont();
+ vcl::Font aFont = m_xTitle->GetFont();
aFont.SetWeight( bBold?WEIGHT_BOLD:WEIGHT_NORMAL );
- m_aTitle->SetFont( aFont );
- m_aTitle->Invalidate();
+ m_xTitle->SetFont( aFont );
+ m_xTitle->Invalidate();
}
void OTableWindow::GetFocus()
{
Window::GetFocus();
// we have to forward the focus to our listbox to enable keystokes
- if(m_pListBox)
- m_pListBox->GrabFocus();
+ if(m_xListBox)
+ m_xListBox->GrabFocus();
}
void OTableWindow::setActive(bool _bActive)
{
SetBoldTitle( _bActive );
m_bActive = _bActive;
- if (!_bActive && m_pListBox && m_pListBox->GetSelectionCount() != 0)
- m_pListBox->SelectAll(false);
+ if (!_bActive && m_xListBox && m_xListBox->GetSelectionCount() != 0)
+ m_xListBox->SelectAll(false);
}
void OTableWindow::Remove()
@@ -544,14 +543,14 @@ void OTableWindow::EnumValidFields(::std::vector< OUString>& arrstrFields)
{
arrstrFields.clear();
// This default implementation counts every item in the ListBox ... for any other behaviour it must be over-written
- if ( m_pListBox )
+ if ( m_xListBox )
{
- arrstrFields.reserve(m_pListBox->GetEntryCount());
- SvTreeListEntry* pEntryLoop = m_pListBox->First();
+ arrstrFields.reserve(m_xListBox->GetEntryCount());
+ SvTreeListEntry* pEntryLoop = m_xListBox->First();
while (pEntryLoop)
{
- arrstrFields.push_back(m_pListBox->GetEntryText(pEntryLoop));
- pEntryLoop = m_pListBox->Next(pEntryLoop);
+ arrstrFields.push_back(m_xListBox->GetEntryText(pEntryLoop));
+ pEntryLoop = m_xListBox->Next(pEntryLoop);
}
}
}
@@ -571,8 +570,8 @@ void OTableWindow::StateChanged( StateChangedType nType )
aFont.Merge( GetControlFont() );
SetZoomedPointFont(*this, aFont);
- m_aTitle->SetZoom(GetZoom());
- m_pListBox->SetZoom(GetZoom());
+ m_xTitle->SetZoom(GetZoom());
+ m_xListBox->SetZoom(GetZoom());
Resize();
Invalidate();
}
@@ -599,11 +598,11 @@ void OTableWindow::Command(const CommandEvent& rEvt)
ptWhere = rEvt.GetMousePosPixel();
else
{
- SvTreeListEntry* pCurrent = m_pListBox->GetCurEntry();
+ SvTreeListEntry* pCurrent = m_xListBox->GetCurEntry();
if ( pCurrent )
- ptWhere = m_pListBox->GetEntryPosition(pCurrent);
+ ptWhere = m_xListBox->GetEntryPosition(pCurrent);
else
- ptWhere = m_aTitle->GetPosPixel();
+ ptWhere = m_xTitle->GetPosPixel();
}
PopupMenu aContextMenu(ModuleRes(RID_MENU_JOINVIEW_TABLE));
@@ -758,7 +757,7 @@ bool OTableWindow::PreNotify(NotifyEvent& rNEvt)
OUString OTableWindow::getTitle() const
{
- return m_aTitle->GetText();
+ return m_xTitle->GetText();
}
void OTableWindow::_elementInserted( const container::ContainerEvent& /*_rEvent*/ ) throw(::com::sun::star::uno::RuntimeException, std::exception)
diff --git a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
index eb1941aa9c19..a2fb61435c13 100644
--- a/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
+++ b/dbaccess/source/ui/querydesign/TableWindowAccess.cxx
@@ -105,16 +105,24 @@ namespace dbaui
{
::osl::MutexGuard aGuard( m_aMutex );
Reference< XAccessible > aRet;
- if(m_pTable && !m_pTable->IsDisposed())
+ if (m_pTable && !m_pTable->IsDisposed())
{
switch(i)
{
case 0:
- aRet = m_pTable->GetTitleCtrl().GetAccessible();
+ {
+ VclPtr<OTableWindowTitle> xCtrl(m_pTable->GetTitleCtrl());
+ if (xCtrl)
+ aRet = xCtrl->GetAccessible();
break;
+ }
case 1:
- aRet = m_pTable->GetListBox()->GetAccessible();
+ {
+ VclPtr<OTableWindowListBox> xCtrl(m_pTable->GetListBox());
+ if (xCtrl)
+ aRet = xCtrl->GetAccessible();
break;
+ }
default:
throw IndexOutOfBoundsException();
}