summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-04-07 00:10:33 +0200
committerJulien Nabet <serval2412@yahoo.fr>2018-04-07 06:39:30 +0200
commit602774aef7d8b2f03914939dd230dd1c67d0093b (patch)
treef76b36bdcc4027bbe9d882ccbc4cc4345560772b
parent3ec490fc757d9a8e395d5e11f138062d86738ff2 (diff)
Fix crash from regression due to ba98f6e3e4dbfc23474e13d59bb08c618ee8c4e5
"Modernize a bit more dbaccess (part2)" 2018-03-10 bt: 0 0x00007fffc7e63986 in Point::X() const (this=0x48) at /home/julien/lo/libreoffice/include/tools/gen.hxx:85 1 0x00007fffc81ab6c8 in dbaui::OTableWindowData::HasPosition() const (this=0x0) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindowData.cxx:68 2 0x00007fffc81a40e7 in dbaui::OTableWindow::OTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, __vtt_parm=0x7fffc87b80a8 <VTT for dbaui::OQueryTableWindow+8>, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/TableWindow.cxx:105 3 0x00007fffc8139909 in dbaui::OQueryTableWindow::OQueryTableWindow(vcl::Window*, std::shared_ptr<dbaui::OTableWindowData> const&) (this=0x555558dd5b40, pParent=0x555558c23ea0, pTabWinData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}, __in_chrg=<optimized out>, __vtt_parm=<optimized out>) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QTableWindow.cxx:54 4 0x00007fffc817b14b in VclPtr<dbaui::OQueryTableWindow>::Create<dbaui::OQueryTableView*, std::shared_ptr<dbaui::OTableWindowData> const&>(dbaui::OQueryTableView*&&, std::shared_ptr<dbaui::OTableWindowData> const&) (arg#0=<unknown type in /home/julien/lo/libreoffice/instdir/program/../program/libdbulo.so, CU 0x3138246, DIE 0x31b256b>, arg#1=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/include/vcl/vclptr.hxx:131 5 0x00007fffc8175cff in dbaui::OQueryTableView::createWindow(std::shared_ptr<dbaui::OTableWindowData> const&) (this= 0x555558c23ea0, _pData=std::shared_ptr<dbaui::OTableWindowData> (empty) = {...}) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:284 6 0x00007fffc8176a28 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rComposedName="table-number", _rTableName="table-number", strAlias="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:419 7 0x00007fffc8176304 in dbaui::OQueryTableView::AddTabWin(rtl::OUString const&, rtl::OUString const&, bool) (this=0x555558c23ea0, _rTableName="table-number", _rAliasName="table-number", bNewTable=false) at /home/julien/lo/libreoffice/dbaccess/source/ui/querydesign/QueryTableView.cxx:357 the fix concerns dbaccess/source/ui/querydesign/QueryTableView.cxx but also fixed some other pbs like: warn:legacy.osl:22883:22883:dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx:1648: OTableFieldDescRef was null! Change-Id: Ief02cdec2f49c0cf04a7a270e66ad27ec255522c Reviewed-on: https://gerrit.libreoffice.org/52527 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx3
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx57
2 files changed, 33 insertions, 27 deletions
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index bf149bba7c23..87fefc9970a7 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -403,7 +403,8 @@ void OQueryTableView::AddTabWin(const OUString& _rComposedName, const OUString&
bool bFoundElem = false;
for (auto const& elem : rWindowData)
{
- if (elem && elem->GetWinName() == strAlias && elem->GetComposedName() == _rComposedName && elem->GetTableName() == _rTableName)
+ pNewTabWinData = elem;
+ if (pNewTabWinData && pNewTabWinData->GetWinName() == strAlias && pNewTabWinData->GetComposedName() == _rComposedName && pNewTabWinData->GetTableName() == _rTableName)
{
bFoundElem = true;
break;
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index b25c72a78be1..b61c9750b1a2 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1614,8 +1614,9 @@ OTableFieldDescRef OSelectionBrowseBox::FindFirstFreeCol(sal_uInt16& _rColumnPos
for (auto const& field : getFields())
{
++_rColumnPosition;
- if ( field.is() && field->IsEmpty() )
- return field;
+ OTableFieldDescRef pEntry = field;
+ if ( pEntry.is() && pEntry->IsEmpty() )
+ return pEntry;
}
return nullptr;
@@ -1645,19 +1646,20 @@ void OSelectionBrowseBox::AddGroupBy( const OTableFieldDescRef& rInfo )
bool bAllFieldsSearched = true;
for (auto const& field : getFields())
{
+ pEntry = field;
OSL_ENSURE(pEntry.is(),"OTableFieldDescRef was null!");
- const OUString aField = field->GetField();
- const OUString aAlias = field->GetAlias();
+ const OUString aField = pEntry->GetField();
+ const OUString aAlias = pEntry->GetAlias();
if (bCase(aField,rInfo->GetField()) &&
bCase(aAlias,rInfo->GetAlias()) &&
- field->GetFunctionType() == rInfo->GetFunctionType() &&
- field->GetFunction() == rInfo->GetFunction())
+ pEntry->GetFunctionType() == rInfo->GetFunctionType() &&
+ pEntry->GetFunction() == rInfo->GetFunction())
{
- if ( field->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
+ if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
{
- field->SetGroupBy(false);
+ pEntry->SetGroupBy(false);
// we do want to consider that bAllFieldsSearched still true here
// bAllFieldsSearched = false;
break;
@@ -1690,10 +1692,11 @@ void OSelectionBrowseBox::DuplicateConditionLevel( const sal_uInt16 nLevel)
const sal_uInt16 nNewLevel = nLevel +1;
for (auto const& field : getFields())
{
- OUString sValue = field->GetCriteria(nLevel);
+ OTableFieldDescRef pEntry = field;
+ OUString sValue = pEntry->GetCriteria(nLevel);
if ( !sValue.isEmpty() )
{
- field->SetCriteria( nNewLevel, sValue);
+ pEntry->SetCriteria( nNewLevel, sValue);
if ( nNewLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1) )
{
RowInserted( GetRowCount()-1 );
@@ -1719,25 +1722,26 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const O
bool bAllFieldsSearched = true;
for (auto const& field : getFields())
{
- const OUString aField = field->GetField();
- const OUString aAlias = field->GetAlias();
+ OTableFieldDescRef pEntry = field;
+ const OUString aField = pEntry->GetField();
+ const OUString aAlias = pEntry->GetAlias();
if (bCase(aField,rInfo->GetField()) &&
bCase(aAlias,rInfo->GetAlias()) &&
- field->GetFunctionType() == rInfo->GetFunctionType() &&
- field->GetFunction() == rInfo->GetFunction() &&
- field->IsGroupBy() == rInfo->IsGroupBy() )
+ pEntry->GetFunctionType() == rInfo->GetFunctionType() &&
+ pEntry->GetFunction() == rInfo->GetFunction() &&
+ pEntry->IsGroupBy() == rInfo->IsGroupBy() )
{
- if ( field->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
- field->SetGroupBy(false);
+ if ( pEntry->isNumericOrAggreateFunction() && rInfo->IsGroupBy() )
+ pEntry->SetGroupBy(false);
else
{
- if(!m_bGroupByUnRelated && field->IsGroupBy())
- field->SetVisible();
+ if(!m_bGroupByUnRelated && pEntry->IsGroupBy())
+ pEntry->SetVisible();
}
- if (field->GetCriteria(nLevel).isEmpty() )
+ if (pEntry->GetCriteria(nLevel).isEmpty() )
{
- field->SetCriteria( nLevel, rValue);
+ pEntry->SetCriteria( nLevel, rValue);
if(nLevel == (m_nVisibleCount-BROW_CRIT1_ROW-1))
{
RowInserted( GetRowCount()-1 );
@@ -1750,7 +1754,7 @@ void OSelectionBrowseBox::AddCondition( const OTableFieldDescRef& rInfo, const O
}
if ( _bAddOrOnOneLine )
{
- pLastEntry = field;
+ pLastEntry = pEntry;
}
}
}
@@ -1807,8 +1811,9 @@ void OSelectionBrowseBox::AddOrder( const OTableFieldDescRef& rInfo, const EOrde
bool bAllFieldsSearched = true;
for (auto const& field : getFields())
{
- OUString aField = field->GetField();
- OUString aAlias = field->GetAlias();
+ pEntry = field;
+ OUString aField = pEntry->GetField();
+ OUString aAlias = pEntry->GetAlias();
if (bCase(aField,rInfo->GetField()) &&
bCase(aAlias,rInfo->GetAlias()))
@@ -1823,8 +1828,8 @@ void OSelectionBrowseBox::AddOrder( const OTableFieldDescRef& rInfo, const EOrde
else
{
if ( !m_bOrderByUnRelated )
- field->SetVisible();
- field->SetOrderDir( eDir );
+ pEntry->SetVisible();
+ pEntry->SetOrderDir( eDir );
m_nLastSortColumn = nPos;
}
bAllFieldsSearched = false;