[Libreoffice-commits] core.git: slideshow/source
Noel Grandin
noel at peralex.com
Wed Mar 2 14:39:38 UTC 2016
slideshow/source/engine/rehearsetimingsactivity.cxx | 2 +-
slideshow/source/engine/shapes/drawinglayeranimation.cxx | 2 +-
slideshow/source/engine/shapes/intrinsicanimationactivity.cxx | 3 ++-
slideshow/source/engine/transitions/slidechangebase.cxx | 4 ++--
slideshow/source/inc/disposable.hxx | 2 ++
5 files changed, 8 insertions(+), 5 deletions(-)
New commits:
commit 037de512546917786c313d23995daaa0521a8e6e
Author: Noel Grandin <noel at peralex.com>
Date: Wed Mar 2 16:28:45 2016 +0200
tdf#98175 fix Impress crash
Caused by my commit f29c0b2b3e8861909fa2c6c37bf631ab01590541
"boost::shared_ptr->std::shared_ptr in slideshow"
where I foolishly converted
shared_from_this()
to
std::shared_ptr<Activity>((Activity*)this) )
all over the place, which is bad, I should have used
std::dynamic_pointer_cast<ViewEventHandler>(shared_from_this())
Ah, the joys of C++ memory management.
Change-Id: I9b538e78730c9107870f406cb8ba482d491dd568
diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx
index eb3b835..4dc66f1 100644
--- a/slideshow/source/engine/rehearsetimingsactivity.cxx
+++ b/slideshow/source/engine/rehearsetimingsactivity.cxx
@@ -217,7 +217,7 @@ void RehearseTimingsActivity::start()
for_each_sprite( []( const ::cppcanvas::CustomSpriteSharedPtr& pSprite )
{ return pSprite->show(); } );
- mrActivitiesQueue.addActivity( std::shared_ptr<Activity>(this) );
+ mrActivitiesQueue.addActivity( std::dynamic_pointer_cast<Activity>(shared_from_this()) );
mpMouseHandler->reset();
mrEventMultiplexer.addClickHandler(
diff --git a/slideshow/source/engine/shapes/drawinglayeranimation.cxx b/slideshow/source/engine/shapes/drawinglayeranimation.cxx
index 5083a4a..08b53ce 100644
--- a/slideshow/source/engine/shapes/drawinglayeranimation.cxx
+++ b/slideshow/source/engine/shapes/drawinglayeranimation.cxx
@@ -859,7 +859,7 @@ ActivityImpl::ActivityImpl(
bool ActivityImpl::enableAnimations()
{
mbIsActive = true;
- return maContext.mrActivitiesQueue.addActivity( ActivitySharedPtr(this) );
+ return maContext.mrActivitiesQueue.addActivity( std::dynamic_pointer_cast<Activity>(shared_from_this()) );
}
ActivityImpl::~ActivityImpl()
diff --git a/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx b/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx
index 8740272..dfefa44 100644
--- a/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx
+++ b/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx
@@ -248,7 +248,8 @@ namespace slideshow
bool IntrinsicAnimationActivity::enableAnimations()
{
mbIsActive = true;
- return maContext.mrActivitiesQueue.addActivity( ActivitySharedPtr(this) );
+ return maContext.mrActivitiesQueue.addActivity( std::dynamic_pointer_cast<Activity>(shared_from_this()) );
+
}
diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx
index e5a24e8..a13dd27 100644
--- a/slideshow/source/engine/transitions/slidechangebase.cxx
+++ b/slideshow/source/engine/transitions/slidechangebase.cxx
@@ -176,7 +176,7 @@ void SlideChangeBase::prefetch( const AnimatableShapeSharedPtr&,
return;
// register ourselves for view change events
- mrEventMultiplexer.addViewHandler( std::shared_ptr<ViewEventHandler>(this) );
+ mrEventMultiplexer.addViewHandler( std::dynamic_pointer_cast<ViewEventHandler>(shared_from_this()) );
// init views and create slide bitmaps
for( const auto& pView : mrViewContainer )
@@ -251,7 +251,7 @@ void SlideChangeBase::end()
mbSpritesVisible = false;
// remove also from event multiplexer, we're dead anyway
- mrEventMultiplexer.removeViewHandler( std::shared_ptr<ViewEventHandler>(this) );
+ mrEventMultiplexer.removeViewHandler( std::dynamic_pointer_cast<ViewEventHandler>(shared_from_this()) );
}
bool SlideChangeBase::operator()( double nValue )
diff --git a/slideshow/source/inc/disposable.hxx b/slideshow/source/inc/disposable.hxx
index c85e369..f1f693a 100644
--- a/slideshow/source/inc/disposable.hxx
+++ b/slideshow/source/inc/disposable.hxx
@@ -36,6 +36,8 @@ namespace slideshow
*/
class SharedPtrAble : public std::enable_shared_from_this<SharedPtrAble>
{
+ public:
+ virtual ~SharedPtrAble() {}
};
/** Disposable interface
More information about the Libreoffice-commits
mailing list