View Issue Details

IDProjectCategoryView StatusLast Update
0006183ardourbugspublic2020-04-19 20:17
Reportertlat Assigned Totlat  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Summary0006183: crash after "stop and forget capture"
Descriptiongit f4203cc

example:

0) new session
1) new track
2) arm track
3) play

   toggle-record 5 or more times to get separate chunks

4) [stop and forget capture]

   game over or, if you are lucky, repeat 3 and 4


There is a reference to _sources[0] (returned from AudioRegion::audio_source)
in `WaveView::invalidate_image_cache' (called from ~WaveView), but the region
is deleted and the size of _sources is zero.

Attached the stack frames and a raw patch.

TagsNo tags attached.

Activities

2015-02-26 16:40

 

stop_and_forget_capture.patch (1,360 bytes)   
diff --git a/libs/canvas/wave_view.cc b/libs/canvas/wave_view.cc
index 3f2c608..606879a 100644
--- a/libs/canvas/wave_view.cc
+++ b/libs/canvas/wave_view.cc
@@ -104,6 +104,15 @@ WaveView::WaveView (Item* parent, boost::shared_ptr<ARDOUR::AudioRegion> region)
 WaveView::~WaveView ()
 {
 	invalidate_image_cache ();
+
+	if (!_image_cache.empty()) {
+		std::map <boost::shared_ptr<ARDOUR::AudioSource>, std::vector <CacheEntry> >::iterator i;
+		for (i = _image_cache.begin(); i != _image_cache.end(); ++i) {
+			if (i->first.unique()) {
+				_image_cache.erase(i->first);
+			}
+		}
+	}
 }
 
 void
@@ -211,6 +220,10 @@ WaveView::invalidate_image_cache ()
 	vector <uint32_t> deletion_list;
 	vector <CacheEntry> caches;
 
+	if (_region->n_channels() == 0) {
+		return;
+	}
+
 	if (_image_cache.find (_region->audio_source ()) != _image_cache.end ()) {
 		caches = _image_cache.find (_region->audio_source ())->second;
 	} else {
@@ -237,10 +250,12 @@ WaveView::invalidate_image_cache ()
 		deletion_list.pop_back();
 	}
 
-	if (caches.size () == 0) {
-		_image_cache.erase(_region->audio_source ());
-	} else {
-		_image_cache[_region->audio_source ()] = caches;
+	if (_region->sources().size() > 0) {
+		if (caches.size () == 0) {
+			_image_cache.erase(_region->audio_source ());
+		} else {
+			_image_cache[_region->audio_source ()] = caches;
+		}
 	}
 
 }
stop_and_forget_capture.patch (1,360 bytes)   

2015-02-26 16:41

 

bt.log (8,529 bytes)   
#0  0x000000000684c6d0 in ?? ()
#1  0x0000000000f426e6 in boost::detail::sp_counted_base::release (this=0x68bc150)
    at /usr/include/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp:146
#2  0x0000000000f42775 in boost::detail::shared_count::~shared_count (this=0x7fffffffba18, 
    __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/detail/shared_count.hpp:371
#3  0x000000000101bff0 in boost::shared_ptr<ARDOUR::Source>::~shared_ptr (this=0x7fffffffba10, 
    __in_chrg=<optimized out>) at /usr/include/boost/smart_ptr/shared_ptr.hpp:328
#4  0x00007ffff6f3d095 in ARDOUR::AudioRegion::audio_source (this=0x7f13e50, n=0)
    at ../libs/ardour/audioregion.cc:1561
#5  0x00007ffff7941d4d in ArdourCanvas::WaveView::invalidate_image_cache (this=0x6578f70)
    at ../libs/canvas/wave_view.cc:214
#6  0x00007ffff79417fc in ArdourCanvas::WaveView::~WaveView (this=0x6578f70, __in_chrg=<optimized out>)
    at ../libs/canvas/wave_view.cc:106
#7  0x00007ffff79418dc in ArdourCanvas::WaveView::~WaveView (this=0x6578f70, __in_chrg=<optimized out>)
    at ../libs/canvas/wave_view.cc:107
#8  0x00007ffff7920f60 in ArdourCanvas::Item::clear_items (this=0x7b15c20, with_delete=true)
    at ../libs/canvas/item.cc:930
#9  0x00007ffff791de6d in ArdourCanvas::Item::~Item (this=0x7b15c20, __in_chrg=<optimized out>)
    at ../libs/canvas/item.cc:103
#10 0x00000000017686c7 in ArdourCanvas::Container::~Container (this=0x7b15c20, __in_chrg=<optimized out>)
    at /mnt/part/src/ardour/libs/canvas/canvas/container.h:39
#11 0x0000000001768700 in ArdourCanvas::Container::~Container (this=0x7b15c20, __in_chrg=<optimized out>)
    at /mnt/part/src/ardour/libs/canvas/canvas/container.h:39
#12 0x000000000130f999 in GhostRegion::~GhostRegion (this=0x69ff650, __in_chrg=<optimized out>)
    at ../gtk2_ardour/ghostregion.cc:73
#13 0x0000000001313d44 in AudioGhostRegion::~AudioGhostRegion (this=0x69ff650, __in_chrg=<optimized out>)
    at ../gtk2_ardour/ghostregion.h:61
#14 0x0000000001313d94 in AudioGhostRegion::~AudioGhostRegion (this=0x69ff650, __in_chrg=<optimized out>)
    at ../gtk2_ardour/ghostregion.h:61
#15 0x00000000015fd679 in RegionView::~RegionView (this=0x7a6cf20, 
    __vtt_parm=0x184d6e8 <VTT for AudioRegionView+8>, __in_chrg=<optimized out>)
    at ../gtk2_ardour/region_view.cc:204
#16 0x0000000001000aa5 in AudioRegionView::~AudioRegionView (this=0x7a6cf20, __in_chrg=<optimized out>, 
    __vtt_parm=<optimized out>) at ../gtk2_ardour/audio_region_view.cc:245
#17 0x0000000001000be0 in AudioRegionView::~AudioRegionView (this=0x7a6cf20, __in_chrg=<optimized out>, 
    __vtt_parm=<optimized out>) at ../gtk2_ardour/audio_region_view.cc:260
#18 0x000000000173cf1b in StreamView::remove_region_view (this=0x7a36160, weak_r=...)
    at ../gtk2_ardour/streamview.cc:194
#19 0x0000000001024c4c in boost::_mfi::mf1<void, StreamView, boost::weak_ptr<ARDOUR::Region> >::call<AudioStreamView*, boost::weak_ptr<ARDOUR::Region> > (this=0x65d0060, u=@0x65d0070: 0x7a36160, b1=...)
    at /usr/include/boost/bind/mem_fn_template.hpp:156
#20 0x000000000102402c in boost::_mfi::mf1<void, StreamView, boost::weak_ptr<ARDOUR::Region> >::operator()<AudioStreamView*> (this=0x65d0060, u=@0x65d0070: 0x7a36160, a1=...)
    at /usr/include/boost/bind/mem_fn_template.hpp:171
#21 0x0000000001022f63 in boost::_bi::list2<boost::_bi::value<AudioStreamView*>, boost::_bi::value<boost::weak_ptr<ARDOUR::Region> > >::operator()<boost::_mfi::mf1<void, StreamView, boost::weak_ptr<ARDOUR::Region> >, boost::_bi::list0> (this=0x65d0070, f=..., a=...) at /usr/include/boost/bind/bind.hpp:313
#22 0x00000000010220db in boost::_bi::bind_t<void, boost::_mfi::mf1<void, StreamView, boost::weak_ptr<ARDOUR::Region> >, boost::_bi::list2<boost::_bi::value<AudioStreamView*>, boost::_bi::value<boost::weak_ptr<ARDOUR::Region> > > >::operator() (this=0x65d0060) at /usr/include/boost/bind/bind_template.hpp:20
#23 0x0000000001020e21 in boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, boost::_mfi::mf1<void, StreamView, boost::weak_ptr<ARDOUR::Region> >, boost::_bi::list2<boost::_bi::value<AudioStreamView*>, boost::_bi::value<boost::weak_ptr<ARDOUR::Region> > > >, void>::invoke (
    function_obj_ptr=...) at /usr/include/boost/function/function_template.hpp:153
#24 0x0000000000f519f0 in boost::function0<void>::operator() (this=0x6db8fb0)
    at /usr/include/boost/function/function_template.hpp:767
#25 0x0000000000f54fea in boost::_bi::list0::operator()<boost::function<void ()>, boost::_bi::list0>(boost::_bi::type<void>, boost::function<void ()>&, boost::_bi::list0&, int) (this=0x6db8fd0, f=...)
    at /usr/include/boost/bind/bind.hpp:192
#26 0x0000000000f546bb in boost::_bi::bind_t<boost::_bi::unspecified, boost::function<void ()>, boost::_bi::list0>::operator()() (this=0x6db8fb0) at /usr/include/boost/bind/bind_template.hpp:20
#27 0x0000000000f53aa4 in boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<boost::_bi::unspecified, boost::function<void ()>, boost::_bi::list0>, void>::invoke(boost::detail::function::function_buffer&) (function_obj_ptr=...) at /usr/include/boost/function/function_template.hpp:153
#28 0x0000000000f519f0 in boost::function0<void>::operator() (this=0x7fffffffc1e0)
    at /usr/include/boost/function/function_template.hpp:767
#29 0x00007ffff5ba1255 in AbstractUI<Gtkmm2ext::UIRequest>::call_slot(PBD::EventLoop::InvalidationRecord*, boost::function<void ()> const&) (this=0x21c2500, invalidation=0x6db92e0, f=...)
    at /mnt/part/src/ardour/libs/pbd/pbd/abstract_ui.cc:372
#30 0x0000000000f50baa in PBD::Signal0<void, PBD::OptionalLastValue<void> >::compositor(boost::function<vo---Type <return> to continue, or q <return> to quit--- 
id ()>, PBD::EventLoop*, PBD::EventLoop::InvalidationRecord*) (f=..., event_loop=0x21c2500, ir=0x6db92e0)
    at /mnt/part/src/ardour/build/libs/pbd/pbd/signals_generated.h:203
#31 0x0000000000f55266 in boost::_bi::list3<boost::_bi::value<boost::function<void ()> >, boost::_bi::value<PBD::EventLoop*>, boost::_bi::value<PBD::EventLoop::InvalidationRecord*> >::operator()<void (*)(boost::function<void ()>, PBD::EventLoop*, PBD::EventLoop::InvalidationRecord*), boost::_bi::list0>(boost::_bi::type<void>, void (*&)(boost::function<void ()>, PBD::EventLoop*, PBD::EventLoop::InvalidationRecord*), boost::_bi::list0&, int) (this=0x69b5e08, f=
    @0x69b5e00: 0xf50b1d <PBD::Signal0<void, PBD::OptionalLastValue<void> >::compositor(boost::function<void ()>, PBD::EventLoop*, PBD::EventLoop::InvalidationRecord*)>, a=...)
    at /usr/include/boost/bind/bind.hpp:392
#32 0x0000000000f54803 in boost::_bi::bind_t<void, void (*)(boost::function<void ()>, PBD::EventLoop*, PBD::EventLoop::InvalidationRecord*), boost::_bi::list3<boost::_bi::value<boost::function<void ()> >, boost::_bi::value<PBD::EventLoop*>, boost::_bi::value<PBD::EventLoop::InvalidationRecord*> > >::operator()() (
    this=0x69b5e00) at /usr/include/boost/bind/bind_template.hpp:20
#33 0x0000000000f53c16 in boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void, void (*)(boost::function<void ()>, PBD::EventLoop*, PBD::EventLoop::InvalidationRecord*), boost::_bi::list3<boost::_bi::value<boost::function<void ()> >, boost::_bi::value<PBD::EventLoop*>, boost::_bi::value<PBD::EventLoop::InvalidationRecord*> > >, void>::invoke(boost::detail::function::function_buffer&) (
    function_obj_ptr=...) at /usr/include/boost/function/function_template.hpp:153
#34 0x0000000000f519f0 in boost::function0<void>::operator() (this=0x7aa4550)
    at /usr/include/boost/function/function_template.hpp:767
#35 0x0000000000f7919e in PBD::Signal0<void, PBD::OptionalLastValue<void> >::operator() (this=0x7f13f80)
    at /mnt/part/src/ardour/build/libs/pbd/pbd/signals_generated.h:312
#36 0x000000000100a474 in PBD::Destructible::drop_references (this=0x7f13f30)
    at /mnt/part/src/ardour/libs/pbd/pbd/destructible.h:36
#37 0x000000000101a4e6 in AudioStreamView::setup_rec_box (this=0x7a36160)
    at ../gtk2_ardour/audio_streamview.cc:268
#38 0x000000000173e51b in StreamView::sess_rec_enable_changed (this=0x7a36160)
    at ../gtk2_ardour/streamview.cc:391
#39 0x0000000001743d79 in boost::_mfi::mf0<void, StreamView>::operator() (this=0x7fffa4036dd8, 
    p=0x7a36160) at /usr/include/boost/bind/mem_fn_template.hpp:49
#40 0x0000000001743404 in boost::_bi::list1<boost::_bi::value<StreamView*> >::operator()<boost::_mfi::mf0<void, StreamView>, boost::_bi::list0> (this=0x7fffa4036de8, f=..., a=...)
    at /usr/include/boost/bind/bind.hpp:253
bt.log (8,529 bytes)   

nick_m

2015-03-24 13:46

reporter   ~0016475

Thanks for the patch.
I've applied a modified version if it in eff25b06f5fe.

tlat

2015-03-24 20:47

reporter   ~0016484

Now it works, thanks.

tlat

2015-03-24 20:48

reporter   ~0016485

fixed in eff25b0

nick_m

2015-03-28 15:19

reporter   ~0016507

I've committed a different fix in 8962bfba
Testing would be appreciated.

system

2020-04-19 20:17

developer   ~0023408

Issue has been closed automatically, by Trigger Close Plugin.
Feel free to re-open with additional information if you think the issue is not resolved.

Issue History

Date Modified Username Field Change
2015-02-26 16:40 tlat New Issue
2015-02-26 16:40 tlat File Added: stop_and_forget_capture.patch
2015-02-26 16:41 tlat File Added: bt.log
2015-03-24 13:46 nick_m Note Added: 0016475
2015-03-24 20:47 tlat Note Added: 0016484
2015-03-24 20:48 tlat Note Added: 0016485
2015-03-24 20:48 tlat Status new => resolved
2015-03-24 20:48 tlat Resolution open => fixed
2015-03-24 20:48 tlat Assigned To => tlat
2015-03-28 15:19 nick_m Note Added: 0016507
2020-04-19 20:17 system Note Added: 0023408
2020-04-19 20:17 system Status resolved => closed