summaryrefslogtreecommitdiffstats
path: root/include/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2015-01-01 09:42:15 +0000
committerMichael Meeks <michael.meeks@collabora.com>2015-04-09 19:53:19 +0100
commit2e03ce9e18ed9d3fe39e8ae847b803ab42234737 (patch)
tree9f5498aa24c1f864ed58cd2e7aa55cc5fbec8169 /include/vcl
parentvcl: convert MessageDialog to use VclReferences. (diff)
downloadcore-2e03ce9e18ed9d3fe39e8ae847b803ab42234737.tar.gz
core-2e03ce9e18ed9d3fe39e8ae847b803ab42234737.zip
vcl: manage SubEdit with references - and fix leak / cleanup.
Change-Id: Icbfe237a55cfbd83739b055350d5a6a54a2fa36d Conflicts: vcl/source/control/edit.cxx
Diffstat (limited to 'include/vcl')
-rw-r--r--include/vcl/combobox.hxx13
-rw-r--r--include/vcl/edit.hxx13
-rw-r--r--include/vcl/vclmedit.hxx2
-rw-r--r--include/vcl/vclref.hxx1
4 files changed, 16 insertions, 13 deletions
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index c7a8cef99851..cde4846bdb2f 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -39,7 +39,7 @@ class ImplBtn;
class VCL_DLLPUBLIC ComboBox : public Edit
{
private:
- Edit* mpSubEdit;
+ VclReference<Edit> mpSubEdit;
ImplListBox* mpImplLB;
ImplBtn* mpBtn;
ImplListBoxFloatingWindow* mpFloatWin;
@@ -48,7 +48,7 @@ private:
bool mbDDAutoSize : 1;
bool mbSyntheticModify : 1;
bool mbMatchCase : 1;
- sal_Int32 m_nMaxWidthChars;
+ sal_Int32 m_nMaxWidthChars;
Link maSelectHdl;
Link maDoubleClickHdl;
boost::signals2::scoped_connection mAutocompleteConnection;
@@ -73,7 +73,7 @@ private:
DECL_DLLPRIVATE_LINK( ImplDoubleClickHdl, void* );
DECL_DLLPRIVATE_LINK( ImplPopupModeEndHdl, void* );
DECL_DLLPRIVATE_LINK( ImplSelectionChangedHdl, void* );
- DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
+ DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
SAL_DLLPRIVATE void ImplClickButtonHandler( ImplBtn* );
SAL_DLLPRIVATE void ImplUserDrawHandler( UserDrawEvent* );
@@ -90,7 +90,7 @@ protected:
protected:
bool IsDropDownBox() const { return mpFloatWin ? true : false; }
- virtual void FillLayoutData() const SAL_OVERRIDE;
+ virtual void FillLayoutData() const SAL_OVERRIDE;
public:
explicit ComboBox( vcl::Window* pParent, WinBits nStyle = 0 );
explicit ComboBox( vcl::Window* pParent, const ResId& );
@@ -119,12 +119,12 @@ public:
Rectangle GetDropDownPosSizePixel() const;
- void AdaptDropDownLineCountToMaximum();
+ void AdaptDropDownLineCountToMaximum();
void SetDropDownLineCount( sal_uInt16 nLines );
sal_uInt16 GetDropDownLineCount() const;
void EnableAutoSize( bool bAuto );
- bool IsAutoSizeEnabled() const { return mbDDAutoSize; }
+ bool IsAutoSizeEnabled() const { return mbDDAutoSize; }
void EnableDDAutoWidth( bool b );
@@ -225,6 +225,7 @@ public:
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
};
+typedef VclReference<ComboBox> ComboBoxPtr;
#endif // _COMBOBOX_HXX
diff --git a/include/vcl/edit.hxx b/include/vcl/edit.hxx
index ec05923011b8..5a28ecb58360 100644
--- a/include/vcl/edit.hxx
+++ b/include/vcl/edit.hxx
@@ -28,6 +28,7 @@
#include <vcl/ctrl.hxx>
#include <vcl/menu.hxx>
#include <vcl/dndhelp.hxx>
+#include <vcl/vclref.hxx>
#include <com/sun/star/uno/Reference.h>
namespace com {
@@ -68,7 +69,7 @@ enum AutocompleteAction{ AUTOCOMPLETE_KEYINPUT, AUTOCOMPLETE_TABFORWARD, AUTOCOM
class VCL_DLLPUBLIC Edit : public Control, public vcl::unohelper::DragAndDropClient
{
private:
- Edit* mpSubEdit;
+ VclReference<Edit> mpSubEdit;
Timer* mpUpdateDataTimer;
TextFilter* mpFilterText;
DDInfo* mpDDInfo;
@@ -85,7 +86,7 @@ private:
sal_Int32 mnMaxWidthChars;
AutocompleteAction meAutocompleteAction;
sal_Unicode mcEchoChar;
- bool mbModified:1,
+ bool mbModified:1,
mbInternModified:1,
mbReadOnly:1,
mbInsertMode:1,
@@ -164,6 +165,7 @@ public:
Edit( vcl::Window* pParent, WinBits nStyle = WB_BORDER );
Edit( vcl::Window* pParent, const ResId& rResId );
virtual ~Edit();
+ virtual void dispose() SAL_OVERRIDE;
virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
@@ -186,7 +188,7 @@ public:
virtual void SetModifyFlag();
virtual void ClearModifyFlag();
- virtual bool IsModified() const { return mpSubEdit ? mpSubEdit->mbModified : mbModified; }
+ virtual bool IsModified() const { return mpSubEdit.get() ? mpSubEdit->mbModified : mbModified; }
virtual void EnableUpdateData( sal_uLong nTimeout = EDIT_UPDATEDATA_TIMEOUT );
virtual void DisableUpdateData() { delete mpUpdateDataTimer; mpUpdateDataTimer = NULL; }
@@ -235,8 +237,8 @@ public:
virtual const Link& GetModifyHdl() const { return maModifyHdl; }
virtual void SetUpdateDataHdl( const Link& rLink ) { maUpdateDataHdl = rLink; }
- void SetSubEdit( Edit* pEdit );
- Edit* GetSubEdit() const { return mpSubEdit; }
+ void SetSubEdit( VclReference<Edit> pEdit );
+ Edit* GetSubEdit() const { return mpSubEdit.get(); }
boost::signals2::signal< void ( Edit* ) > autocompleteSignal;
AutocompleteAction GetAutocompleteAction() const { return meAutocompleteAction; }
@@ -268,6 +270,7 @@ public:
// global style settings (needed by sc's inputwin.cxx)
static Size GetMinimumEditSize();
};
+typedef VclReference<Edit> EditRef;
#endif // INCLUDED_VCL_EDIT_HXX
diff --git a/include/vcl/vclmedit.hxx b/include/vcl/vclmedit.hxx
index 649725b1c1f2..382059b9a420 100644
--- a/include/vcl/vclmedit.hxx
+++ b/include/vcl/vclmedit.hxx
@@ -25,7 +25,6 @@
#include <vcl/edit.hxx>
#include <vcl/dllapi.h>
-
class ImpVclMEdit;
class Timer;
class ExtTextEngine;
@@ -131,6 +130,7 @@ public:
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
};
+typedef VclReference<VclMultiLineEdit> VclMultiLineEditRef;
#endif // INCLUDED_VCL_VCLMEDIT_HXX
diff --git a/include/vcl/vclref.hxx b/include/vcl/vclref.hxx
index b9b7b530d522..ba3fdaa70719 100644
--- a/include/vcl/vclref.hxx
+++ b/include/vcl/vclref.hxx
@@ -75,7 +75,6 @@ public:
// hold it alive for the lifetime of this method
::rtl::Reference<reference_type> aTmp(m_rInnerRef);
m_rInnerRef.clear(); // we should use some 'swap' method ideally ;-)
- assert(aTmp.get());
if (aTmp.get())
aTmp->dispose();
}