summaryrefslogtreecommitdiffstats
path: root/slideshow
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-03-02 16:28:45 +0200
committerNoel Grandin <noel@peralex.com>2016-03-02 16:39:13 +0200
commit037de512546917786c313d23995daaa0521a8e6e (patch)
tree7bff7e3ad727708b6f44adc0753440c6f7813c6c /slideshow
parentadd tooltips about Excel interoperability (diff)
downloadcore-037de512546917786c313d23995daaa0521a8e6e.tar.gz
core-037de512546917786c313d23995daaa0521a8e6e.zip
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
Diffstat (limited to 'slideshow')
-rw-r--r--slideshow/source/engine/rehearsetimingsactivity.cxx2
-rw-r--r--slideshow/source/engine/shapes/drawinglayeranimation.cxx2
-rw-r--r--slideshow/source/engine/shapes/intrinsicanimationactivity.cxx3
-rw-r--r--slideshow/source/engine/transitions/slidechangebase.cxx4
-rw-r--r--slideshow/source/inc/disposable.hxx2
5 files changed, 8 insertions, 5 deletions
diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx
index eb3b835650c0..4dc66f19c109 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 5083a4a34ef1..08b53cef34ca 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 8740272be899..dfefa44bad4f 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 e5a24e8450a2..a13dd27be25f 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 c85e3698e953..f1f693a23e33 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