mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-07 07:14:56 +01:00
waveform, mutex for _current_image
may be used in render-thread while invalidate_image_cache() is called. possible fix for #6478
This commit is contained in:
parent
fa32fa1abe
commit
93aa8d3734
2 changed files with 5 additions and 0 deletions
|
|
@ -401,6 +401,7 @@ public:
|
||||||
|
|
||||||
static gint drawing_thread_should_quit;
|
static gint drawing_thread_should_quit;
|
||||||
static Glib::Threads::Mutex request_queue_lock;
|
static Glib::Threads::Mutex request_queue_lock;
|
||||||
|
static Glib::Threads::Mutex current_image_lock;
|
||||||
static Glib::Threads::Cond request_cond;
|
static Glib::Threads::Cond request_cond;
|
||||||
static Glib::Threads::Thread* _drawing_thread;
|
static Glib::Threads::Thread* _drawing_thread;
|
||||||
typedef std::set<WaveView const *> DrawingRequestQueue;
|
typedef std::set<WaveView const *> DrawingRequestQueue;
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ double WaveView::_clip_level = 0.98853;
|
||||||
WaveViewCache* WaveView::images = 0;
|
WaveViewCache* WaveView::images = 0;
|
||||||
gint WaveView::drawing_thread_should_quit = 0;
|
gint WaveView::drawing_thread_should_quit = 0;
|
||||||
Glib::Threads::Mutex WaveView::request_queue_lock;
|
Glib::Threads::Mutex WaveView::request_queue_lock;
|
||||||
|
Glib::Threads::Mutex WaveView::current_image_lock;
|
||||||
Glib::Threads::Cond WaveView::request_cond;
|
Glib::Threads::Cond WaveView::request_cond;
|
||||||
Glib::Threads::Thread* WaveView::_drawing_thread = 0;
|
Glib::Threads::Thread* WaveView::_drawing_thread = 0;
|
||||||
WaveView::DrawingRequestQueue WaveView::request_queue;
|
WaveView::DrawingRequestQueue WaveView::request_queue;
|
||||||
|
|
@ -263,6 +264,7 @@ WaveView::invalidate_image_cache ()
|
||||||
{
|
{
|
||||||
DEBUG_TRACE (DEBUG::WaveView, string_compose ("%1 invalidates image cache and cancels current request\n", this));
|
DEBUG_TRACE (DEBUG::WaveView, string_compose ("%1 invalidates image cache and cancels current request\n", this));
|
||||||
cancel_my_render_request ();
|
cancel_my_render_request ();
|
||||||
|
Glib::Threads::Mutex::Lock lci (current_image_lock);
|
||||||
_current_image.reset ();
|
_current_image.reset ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1119,6 +1121,7 @@ WaveView::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) cons
|
||||||
double image_origin_in_self_coordinates;
|
double image_origin_in_self_coordinates;
|
||||||
boost::shared_ptr<WaveViewCache::Entry> image_to_draw;
|
boost::shared_ptr<WaveViewCache::Entry> image_to_draw;
|
||||||
|
|
||||||
|
Glib::Threads::Mutex::Lock lci (current_image_lock);
|
||||||
if (_current_image) {
|
if (_current_image) {
|
||||||
|
|
||||||
/* check it covers the right sample range */
|
/* check it covers the right sample range */
|
||||||
|
|
@ -1181,6 +1184,7 @@ WaveView::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) cons
|
||||||
double draw_width;
|
double draw_width;
|
||||||
|
|
||||||
if (image_to_draw != _current_image) {
|
if (image_to_draw != _current_image) {
|
||||||
|
lci.release ();
|
||||||
|
|
||||||
/* the image is guaranteed to start at or before
|
/* the image is guaranteed to start at or before
|
||||||
* draw_start. But if it starts before draw_start, that reduces
|
* draw_start. But if it starts before draw_start, that reduces
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue