summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f871dce)
Fixes bug in which a stage visual can be staged again, caused a new renderer to be created and lost the handle to prevous renderer.
Meant stray renderers could exist in the control. Leak!
Visual bases checks if visual already staged before adding to stage Fixes bug in which a staged visual can be staged again, caused a new renderer to be created and lost the handle to previous renderer. Meant stray a renderer could exist in the control. Leak! Can occur in control development or with direct use of Visual::SetOnStage. Control Example. Button:Setup { register visual A register visual B } Button::OnStageConnection { enable visual A (call 1) enable visual B Control::OnStageConnection; (call 2) } Call 1 initializes a renderer and puts it on stage. Call 2 initializes and puts on stage all registered visuals without checking if already staged.
Logging in control increased
Change-Id: I98383cac66e833b13765d8aef88767a3e09946b2
void ImageVisual::InitializeRenderer( const std::string& imageUrl )
{
void ImageVisual::InitializeRenderer( const std::string& imageUrl )
{
- mImpl->mRenderer.Reset();
+ DALI_ASSERT_DEBUG( !mImpl->mRenderer && "Renderer should have been removed from stage and already reset before initialization" );
mImageUrl = imageUrl;
mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
mImageUrl = imageUrl;
mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
void ImageVisual::InitializeRenderer( const Image& image )
{
void ImageVisual::InitializeRenderer( const Image& image )
{
+ DALI_ASSERT_DEBUG( !mImpl->mRenderer && "Renderer should have been removed from stage and already reset before initialization" );
+
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;
- mImpl->mRenderer.Reset();
// don't reuse CreateTextureSet
TextureSet textures = TextureSet::New();
// don't reuse CreateTextureSet
TextureSet textures = TextureSet::New();
void Visual::Base::SetOnStage( Actor& actor )
{
void Visual::Base::SetOnStage( Actor& actor )
{
- // To display the actor correctly, renderer should not be added to actor until all required resources are ready.
- // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing.
- DoSetOnStage( actor );
-
- if( mImpl->mRenderer )
- mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled());
- mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex );
- mImpl->mFlags |= Impl::IS_ON_STAGE; // Only sets the flag if renderer exists
+ // To display the actor correctly, renderer should not be added to actor until all required resources are ready.
+ // Thus the calling of actor.AddRenderer() should happen inside derived class as base class does not know the exact timing.
+ DoSetOnStage( actor );
+
+ if( mImpl->mRenderer )
+ {
+ mImpl->mRenderer.SetProperty( Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, IsPreMultipliedAlphaEnabled());
+ mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, mImpl->mDepthIndex );
+ mImpl->mFlags |= Impl::IS_ON_STAGE; // Only sets the flag if renderer exists
+ }
{
if ( (*iter)->enabled == enable )
{
{
if ( (*iter)->enabled == enable )
{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Visual Already enabled set (%s) \n", enable?"enabled":"disabled");
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting Visual(%d) on stage \n", index );
Toolkit::GetImplementation((*iter)->visual).SetOnStage( parentActor );
}
else
{
Toolkit::GetImplementation((*iter)->visual).SetOnStage( parentActor );
}
else
{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::EnableVisual Setting Visual(%d) off stage \n", index );
Toolkit::GetImplementation((*iter)->visual).SetOffStage( parentActor ); // No need to call if control not staged.
}
}
Toolkit::GetImplementation((*iter)->visual).SetOffStage( parentActor ); // No need to call if control not staged.
}
}
void Control::OnStageConnection( int depth )
{
void Control::OnStageConnection( int depth )
{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageConnection number of registered visuals(%d)\n", mImpl->mVisuals.Size() );
+
for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++)
{
// Check whether the visual is empty and enabled
if( (*iter)->visual && (*iter)->enabled )
{
for(RegisteredVisualContainer::Iterator iter = mImpl->mVisuals.Begin(); iter!= mImpl->mVisuals.End(); iter++)
{
// Check whether the visual is empty and enabled
if( (*iter)->visual && (*iter)->enabled )
{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageConnection Setting visual(%d) on stage\n", (*iter)->index );
Actor self( Self() );
Toolkit::GetImplementation((*iter)->visual).SetOnStage( self );
}
Actor self( Self() );
Toolkit::GetImplementation((*iter)->visual).SetOnStage( self );
}
// Check whether the visual is empty
if( (*iter)->visual )
{
// Check whether the visual is empty
if( (*iter)->visual )
{
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Control::OnStageDisconnection Setting visual(%d) off stage\n", (*iter)->index );
Actor self( Self() );
Toolkit::GetImplementation((*iter)->visual).SetOffStage( self );
}
Actor self( Self() );
Toolkit::GetImplementation((*iter)->visual).SetOffStage( self );
}