X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FUIComponents%2FButton.cs;h=1cffbcc3e2e3960da80794dfb81d714461e87ea6;hb=5e1c35c38b2bc29eebc484679f7de727b636f744;hp=a67858daadb23950b90a5723c1347af5f04f6234;hpb=09522e322c3272c3d48bdfbec3edd9b22a0822d0;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
diff --git a/src/Tizen.NUI/src/public/UIComponents/Button.cs b/src/Tizen.NUI/src/public/UIComponents/Button.cs
index a67858d..1cffbcc 100755
--- a/src/Tizen.NUI/src/public/UIComponents/Button.cs
+++ b/src/Tizen.NUI/src/public/UIComponents/Button.cs
@@ -24,17 +24,17 @@ namespace Tizen.NUI.UIComponents
using Tizen.NUI.BaseComponents;
///
- /// Button is a base class for different kinds of buttons.
+ /// The Button class is a base class for different kinds of buttons.
/// This class provides the disabled property and the clicked signal.
- /// A Clicked event handler is emitted when the button is touched and the touch point doesn't leave the boundary of the button.
+ /// The clicked event handler is emitted when the button is touched, and the touch point doesn't leave the boundary of the button.
/// When the disabled property is set to true, no signal is emitted.
- /// 'Visual' describes not just traditional images like png, bmp but refers to whatever is used to show the button, it could be a color, gradient or some other kind of renderer.
- /// The button's appearance can be modified by setting properties for the various visuals/images.
- /// It is not mandatory to set all visuals. A button could be defined only by setting its background visual or by setting its background and selected visuals.
+ /// The 'Visual' describes not just traditional images like PNG and BMP, but also refers to whatever is used to show the button. It could be a color, gradient, or some other kind of renderer.
+ /// The button's appearance can be modified by setting properties for the various visuals or images.
+ /// It is not mandatory to set all the visuals. A button could be defined only by setting its background visual, or by setting its background and selected visuals.
/// The button visual is shown over the background visual.
- /// When pressed the unselected visuals are replaced by the selected visual.
+ /// When pressed, the unselected visuals are replaced by the selected visuals.
/// The text label is always placed on the top of all images.
- /// When the button is disabled, background, button and selected visuals are replaced by their disabled visuals.
+ /// When the button is disabled, the background button and the selected visuals are replaced by their disabled visuals.
///
public class Button : View
{
@@ -51,7 +51,7 @@ namespace Tizen.NUI.UIComponents
}
///
- /// To make Button instance be disposed.
+ /// To dispose the button instance.
///
protected override void Dispose(DisposeTypes type)
{
@@ -72,6 +72,8 @@ namespace Tizen.NUI.UIComponents
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
+ DisConnectFromSignals();
+
if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
if (swigCMemOwn)
@@ -85,6 +87,39 @@ namespace Tizen.NUI.UIComponents
base.Dispose(type);
}
+ private void DisConnectFromSignals()
+ {
+ // Save current CPtr.
+ global::System.Runtime.InteropServices.HandleRef currentCPtr = swigCPtr;
+
+ // Use BaseHandle CPtr as current might have been deleted already in derived classes.
+ swigCPtr = GetBaseHandleCPtrHandleRef;
+
+ if (_stateChangedCallback != null)
+ {
+ StateChangedSignal().Disconnect(_stateChangedCallback);
+ }
+
+ if (_releasedCallback != null)
+ {
+ ReleasedSignal().Disconnect(_releasedCallback);
+ }
+
+ if (_pressedCallback != null)
+ {
+ this.PressedSignal().Disconnect(_pressedCallback);
+ }
+
+ if (_clickedCallback != null)
+ {
+ ClickedSignal().Disconnect(_clickedCallback);
+ }
+
+ // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here.
+ // Restore current CPtr.
+ swigCPtr = currentCPtr;
+ }
+
private EventHandlerWithReturnType