Commit 48ba56a58d2b0bdd898b415599e8d1f9ea3ee96c

Authored by Adeel Kazmi
Committed by Gerrit Code Review
2 parents 649dcba0 48870145

Merge "Fixed memory leak in text-field demo" into devel/master

examples/text-field/text-field-example.cpp
... ... @@ -99,6 +99,9 @@ public:
99 99 Stage stage = Stage::GetCurrent();
100 100 Vector2 stageSize = stage.GetSize();
101 101  
  102 + // Remove previously hidden pop-up
  103 + UnparentAndReset(mPopup);
  104 +
102 105 // Launch a pop-up containing TextField
103 106 mField = CreateTextField( stageSize, mButtonLabel );
104 107 mPopup = CreatePopup( stageSize.width * 0.8f );
... ... @@ -117,6 +120,7 @@ public:
117 120 field.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
118 121 field.SetProperty( TextField::Property::TEXT, text );
119 122 field.SetProperty( TextField::Property::TEXT_COLOR, Vector4( 0.0f, 1.0f, 1.0f, 1.0f ) ); // CYAN
  123 + field.SetProperty( TextField::Property::PRIMARY_CURSOR_COLOR, Color::WHITE );
120 124 field.SetProperty( TextField::Property::PLACEHOLDER_TEXT, "Unnamed folder" );
121 125 field.SetProperty( TextField::Property::PLACEHOLDER_TEXT_FOCUSED, "Enter folder name." );
122 126 field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( BORDER_WIDTH, BORDER_WIDTH, stageSize.width - BORDER_WIDTH*2, stageSize.height - BORDER_WIDTH*2 ) );
... ... @@ -154,7 +158,6 @@ public:
154 158 mPopup.Hide();
155 159 }
156 160 mField.Reset();
157   - mPopup.Reset();
158 161 }
159 162  
160 163 bool OnPopupTouched( Actor actor, const TouchEvent& event )
... ...