[Summary] Allow user to use Enter and Esc in Add track dialog
[ardour.git] / patch.diff
1 From 87184ab80d80b1ef0301344bfd633b2d81476c9a Mon Sep 17 00:00:00 2001
2 From: Paul Davis <paul@linuxaudiosystems.com>
3 Date: Mon, 24 Mar 2014 17:47:56 -0400
4 Subject: [PATCH] fix a race condition between the death of a thread that
5  communicates with an UI event loop and the event loop itself.
6
7 The comment tries to explain it all. There may be a better solution, but I believe that this one is
8 (a) safe (b) better than the old approach.
9 ---
10  libs/pbd/pbd/abstract_ui.cc | 18 +++++++++---------
11  1 file changed, 9 insertions(+), 9 deletions(-)
12
13 diff --git a/libs/pbd/pbd/abstract_ui.cc b/libs/pbd/pbd/abstract_ui.cc
14 index 67c39b5..b0ac676 100644
15 --- a/libs/pbd/pbd/abstract_ui.cc
16 +++ b/libs/pbd/pbd/abstract_ui.cc
17 @@ -44,18 +44,18 @@ cleanup_request_buffer (void* ptr)
18  {
19          RequestBuffer* rb = (RequestBuffer*) ptr;
20         
21 -       /* there is the question of why we don't simply erase the request
22 -        * buffer and delete it right here, since we have to take the lock
23 -        * anyway.
24 +       /* this is called when the thread for which this request buffer was
25 +        * allocated dies. That could be before or after the end of the UI
26 +        * event loop that the request buffer communicates.
27          *
28 -        * as of april 24th 2012, i don't have a good answer to that.
29 +        * We are not modifying the UI's thread/buffer map, just marking it 
30 +        * dead. If the UI is currently processing the buffers and misses
31 +        * this "dead" signal, it will find it the next time it receives
32 +        * a request. If the UI has finished processing requests, then
33 +        * we will leak this buffer object.
34          */
35          
36 -
37 -        {
38 -                Glib::Threads::Mutex::Lock lm (rb->ui.request_buffer_map_lock);
39 -                rb->dead = true;
40 -        }
41 +       rb->dead = true;
42  }
43  
44  template<typename R>
45 -- 
46 1.8.1.msysgit.1
47