[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/source
Caolán McNamara
caolanm at redhat.com
Mon Feb 2 06:45:55 PST 2015
sw/source/uibase/wrtsh/wrtsh2.cxx | 57 ++++++++++++++++++++++----------------
1 file changed, 34 insertions(+), 23 deletions(-)
New commits:
commit 092a73d070e05f54990151fdc4e66e8adac8097d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jan 28 15:57:10 2015 +0000
Related: tdf#82942 multiple crashes on changing text in SwInputFields
i.e. load doc keeping setting text of "LINE" + ok as each popup appears
will crash eventually
Change-Id: Ibc4bb8fe65bd5dd380c0fe833e5ece2b39de5dbe
(cherry picked from commit 1ecf795ffaf8c63280ea92f776b53558b3227504)
WaE: overriding destructor declaration not explicitly marked 'virtual'
Change-Id: I4f155f8a28afa6a16b1859b254a339d8374a769b
(cherry picked from commit e6a1f33e500c4fb5e38e7d6de7ddb55af8fa8650)
coverity#1267699 Uninitialized pointer field
Change-Id: I9d830e56bd06208664296f3310cd61b97588d160
(cherry picked from commit 51af2166d16ea5d47ee9b92ada2d95adff168bb2)
Reviewed-on: https://gerrit.libreoffice.org/14261
Tested-by: Michael Stahl <mstahl at redhat.com>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 786ce99..e8da12b 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -175,7 +175,35 @@ void SwWrtShell::UpdateInputFlds( SwInputFieldList* pLst )
class FieldDeletionModify : public SwModify
{
public:
- FieldDeletionModify(AbstractFldInputDlg* pInputFieldDlg) : mpInputFieldDlg(pInputFieldDlg) {}
+ FieldDeletionModify(AbstractFldInputDlg* pInputFieldDlg, SwField* pFld)
+ : mpInputFieldDlg(pInputFieldDlg)
+ , mpFmtFld(NULL)
+ {
+ SwInputField *const pInputField(dynamic_cast<SwInputField*>(pFld));
+ SwSetExpField *const pSetExpFld(dynamic_cast<SwSetExpField*>(pFld));
+
+ if (pInputField && pInputField->GetFmtFld())
+ {
+ mpFmtFld = pInputField->GetFmtFld();
+ }
+ else if (pSetExpFld && pSetExpFld->GetFmtFld())
+ {
+ mpFmtFld = pSetExpFld->GetFmtFld();
+ }
+
+ // Register for possible field deletion while dialog is open
+ if (mpFmtFld)
+ mpFmtFld->Add(this);
+ }
+
+ virtual ~FieldDeletionModify()
+ {
+ if (mpFmtFld)
+ {
+ // Dialog closed, remove modification listener
+ mpFmtFld->Remove(this);
+ }
+ }
void Modify( const SfxPoolItem* pOld, const SfxPoolItem *) SAL_OVERRIDE
{
@@ -186,6 +214,7 @@ class FieldDeletionModify : public SwModify
{
case RES_REMOVE_UNO_OBJECT:
case RES_OBJECTDYING:
+ mpFmtFld = NULL;
mpInputFieldDlg->EndDialog(RET_CANCEL);
break;
}
@@ -193,10 +222,10 @@ class FieldDeletionModify : public SwModify
}
private:
AbstractFldInputDlg* mpInputFieldDlg;
+ SwFmtFld* mpFmtFld;
};
// Start input dialog for a specific field
-
bool SwWrtShell::StartInputFldDlg( SwField* pFld, bool bNextButton,
vcl::Window* pParentWin, OString* pWindowState )
{
@@ -208,29 +237,11 @@ bool SwWrtShell::StartInputFldDlg( SwField* pFld, bool bNextButton,
if(pWindowState && !pWindowState->isEmpty())
pDlg->SetWindowState(*pWindowState);
- FieldDeletionModify aModify(pDlg.get());
- SwInputField *const pInputField(dynamic_cast<SwInputField*>(pFld));
- SwSetExpField *const pSetExpFld(dynamic_cast<SwSetExpField*>(pFld));
- if (pInputField && pInputField->GetFmtFld())
- {
- // Register for possible input field deletion while dialog is open
- pInputField->GetFmtFld()->Add(&aModify);
- }
- else if (pSetExpFld && pSetExpFld->GetFmtFld())
- {
- pSetExpFld->GetFmtFld()->Add(&aModify);
- }
-
- bool bRet = RET_CANCEL == pDlg->Execute();
+ bool bRet;
- if (pInputField && pInputField->GetFmtFld())
- {
- // Dialog closed, remove modification listener
- pInputField->GetFmtFld()->Remove(&aModify);
- }
- else if (pSetExpFld && pSetExpFld->GetFmtFld())
{
- pSetExpFld->GetFmtFld()->Remove(&aModify);
+ FieldDeletionModify aModify(pDlg.get(), pFld);
+ bRet = RET_CANCEL == pDlg->Execute();
}
if(pWindowState)
More information about the Libreoffice-commits
mailing list