summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd/abstract_ui.cc
AgeCommit message (Collapse)Author
2019-08-03Update core library GPL boilerplate and (C) from git logRobin Gareus
2017-01-20Free dead request-buffersRobin Gareus
This partially plugs a memory leak of event-loops.
2016-12-16MIDI tracer actually changes the event-loopRobin Gareus
2016-12-15some further invalidation details:Robin Gareus
Prevent double unref during when the EventLoop terminates: deleting the ringbuffer deletes all requests, some of which may contain stale invalidation remove the buffer_map_lock, now that signals ref-count the IR.
2016-12-15std::list::erase() needs a non-const iterator.;Paul Davis
at least for some versions of gcc.
2016-12-15and now with eraseRobin Gareus
2016-12-15C++98 compatible iterator eraseRobin Gareus
2016-12-15rework request invalidationRobin Gareus
This kills 2 birds with 1 stone: Removes the necessity of locks and makes call_slot() realtime safe (req->invalidation->requests list push_back). On object destruction, the invalidation-record (IR) itself is invalidated. Invalidated IRs are pushed onto a trash-pool and deleted in the event-loop of the invalidated object (GUI thread) once all requests that reference it have been processed. One last detail remains: PBD::signal connect should reference the IR and disconnect unreference it. This will guarantee that signal emission will not reference the IR while the pool trash is dropped.
2016-12-14Add a trash pool for invalidation requests.Robin Gareus
While EventLoop::invalidate_request() does invalidate request in the request-list. It does *not* invalidate requests in the per-thread-request-ringbuffer(s). The invalidation record cannot be deleted in EventLoop::invalidate_request see 6b5891a78f.
2016-12-14Atomically to invalidate requestRobin Gareus
Yet another slightly overkill approach, but it /may/ explain crashes.
2016-12-14Add some more invalidation debug messages.Robin Gareus
2016-12-14The threading anecdotes - Episode 7Robin Gareus
When do_request() destroys the receiver object, the receiver will free the invalidation record. So the IR needs to be removed from the list before executing the request. Invalid read of size 8 at: AbstractUI<Gtkmm2ext::UIRequest>::handle_ui_requests() (abstract_ui.cc:242) by: BaseUI::request_handler(Glib::IOCondition) (base_ui.cc:141) by: sigc::bound_mem_functor1<bool, BaseUI, Glib::IOCondition>::operator()(Glib::IOCondition const&) const (mem_fun.h:2066) by: sigc::adaptor_functor<sigc::bound_mem_functor1<bool, BaseUI, Glib::IOCondition> >::deduce_result_type<Glib::IOCondition const&, void, void, void, void, void, void>::type sigc::adaptor_functor<sigc::bound_mem_functor1<bool, BaseUI, Glib::IOCondition> >::operator()<Glib::IOCondition const&>(Glib::IOCondition const&) const (adaptor_trait.h:89) by: sigc::internal::slot_call1<sigc::bound_mem_functor1<bool, BaseUI, Glib::IOCondition>, bool, Glib::IOCondition>::call_it(sigc::internal::slot_rep*, Glib::IOCondition const&) (slot.h:148) by: sigc::slot1<bool, Glib::IOCondition>::operator()(Glib::IOCondition const&) const (slot.h:643) by: cross_thread_channel_call_receive_slot(_GIOChannel*, GIOCondition, void*) (crossthread.cc:49) by: g_main_context_dispatch (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.2) by: ??? (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.2) by: g_main_loop_run (in /lib/x86_64-linux-gnu/libglib-2.0.so.0.5000.2) by: gtk_main (in /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0.2400.31) by: Gtkmm2ext::UI::run(Receiver&) (gtk_ui.cc:286) by main (main.cc:408) Addrd1b8 is 24 bytes inside a block of size 48 free'd at: operator delete(void*) (vg_replace_malloc.c:576) by: PBD::EventLoop::invalidate_request(void*) (event_loop.cc:98) by: sigc::internal::trackable_callback_list::~trackable_callback_list() (in /usr/lib/x86_64-linux-gnu/libsigc-2.0.so.0.0.0) by: sigc::trackable::notify_callbacks() (in /usr/lib/x86_64-linux-gnu/libsigc-2.0.so.0.0.0) by: ProcessorEntry::LuaPluginDisplay::~LuaPluginDisplay() (processor_box.cc:1757) by: ProcessorEntry::LuaPluginDisplay::~LuaPluginDisplay() (processor_box.cc:1760) by: ProcessorEntry::~ProcessorEntry() (processor_box.cc:251)
2016-12-14skip dead threads (if the event remains, it'll be cleaned up below)Robin Gareus
2016-12-14fix potential invalid lockRobin Gareus
2016-12-14rework locking (fa07233a, 112fba182)Robin Gareus
For now: use a single lock, which should fix all related crashes. optimize (with less contended partial locks) if this works.
2016-12-14amend prev commitRobin Gareus
2016-12-13mutex 'er upRobin Gareus
Some overzealous locking to track down RequestObject related crashes. bc0fa4d689a4 wrongly locked the current event loop's request_invalidation_lock instead of the invalidation's list lock. Also Abstract UI is able to delete requests concurrently with with EventLoop invalidation. e.g. PortManager::PortRegisteredOrUnregistered and GlobalPortMatrixWindow so the lock needs to be exposed. If this solves various issues, mutexes should to be consolidated (request_buffer_map_lock + request_invalidation_lock) and be chosen such that there is as little contention as possible.
2016-12-07Fix another crash at exit.Robin Gareus
2016-11-24Fix mysterious crashes such as #7049Robin Gareus
Fixes an issue with corrupted std::lists<> due to concurrent writes to the invalidation list which eventually resulted in EventLoop::invalidate_request() not invalidating requests. Concurrency sucks rocks hard.
2016-07-14enough with umpteen "i18n.h" files. Consolidate on pbd/i18n.hPaul Davis
2016-04-24some notes on mem-leaks...Robin Gareus
2016-01-16clean up functors used in cross-thread call_slot() messages, in case they ↵Paul Davis
contain shared_ptr<T>, which could result in a dangling reference
2016-01-14remove debug outputPaul Davis
2016-01-14fully clean up request buffers when a thread diesPaul Davis
2016-01-14manually revert 4b3043cc and 141e6fb8181; add detailed explanatory commentPaul Davis
2016-01-13don't pick up already dead thread request buffers when setting up an event loopPaul Davis
2016-01-13more event loop debuggingPaul Davis
2016-01-13typo fixPaul Davis
2016-01-13lots more DEBUG_TRACE statements for analysing malfunctioning systemPaul Davis
2016-01-10remove debug output4.5Paul Davis
2015-12-28redesign cross-thread registration/signalling systemPaul Davis
This new design will work even when threads that need to receive messages from RT threads are created *after* the RT threads. The existing design would fail because the RT thread(s) would never be known the later created threads, and so signals emitted by the RT thread and causing call_slot() in the receiver would end up being enqueued using a lock-protected list. The new design ensures that communication always uses a lock-free FIFO instead
2015-12-13portable pthread_self() debug messageRobin Gareus
2015-12-12change AbstractUI implementation to use EventLoop::event_loop_name() and add ↵Paul Davis
extra DEBUG_TRACE statements to track thread registration with event loops
2015-12-12fix endless-loop-at-shutdown bug now that abstract UI request buffers are usedPaul Davis
2015-12-12NO-OP re-indentRobin Gareus
2015-12-12remove invalid free. - fixes crash with generic midi surfaceRobin Gareus
if there is a per_thread_request_buffer, get_request() simply puts a POD RequestType on the ringbuffer's head. send_request() increases the write-pointer. There is no memory to free.
2015-10-05NOOP, remove trailing tabs/whitespace.Robin Gareus
2015-10-04globally remove all trailing whitespace from ardour code base.Paul Davis
Paul Davis was responsible for introducing almost all of this.
2014-06-15plug some leaksRobin Gareus
2014-03-24comment tweakPaul Davis
2014-03-24fix a race condition between the death of a thread that communicates with an ↵Paul Davis
UI event loop and the event loop itself. The comment tries to explain it all. There may be a better solution, but I believe that this one is (a) safe (b) better than the old approach.
2013-12-01'libs/pbd' - DLL visibility stuff and associated changes needed for building ↵John Emmas
with MSVC. Currently includes debugging information and things that are just commented out until we have known compatibility with the other platforms (i.e. contains stuff to be removed at a later date)
2013-07-16Windows (compiler specific) includes for libpbdJohn Emmas
2013-07-11Hide UI request mechanism from inheriting classesPaul Davis
2013-07-11Use PBD::pthread_name in debug output instead of pthread_selfPaul Davis
2013-01-16add copyright commentsPaul Davis
git-svn-id: svn://localhost/ardour2/branches/3.0@13857 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-07-25convert from Glib:: to Glib::Threads for all thread-related APIPaul Davis
git-svn-id: svn://localhost/ardour2/branches/3.0@13084 d708f5d6-7413-0410-9779-e7cbd77b26cf
2012-04-24eventloop and abstractui debugging, lots more commenting on ↵Paul Davis
abstractui/eventloop implementation; minor tweaks elsewhere git-svn-id: svn://localhost/ardour2/branches/3.0@12076 d708f5d6-7413-0410-9779-e7cbd77b26cf
2011-02-07forward port thread/abstract_ui changes from 2.X to 3.0Paul Davis
git-svn-id: svn://localhost/ardour2/branches/3.0@8751 d708f5d6-7413-0410-9779-e7cbd77b26cf
2010-04-03Allow cross-thread request invalidators to cope with multiple requestsCarl Hetherington
being logged before they are handled, and to invalidate them all rather than just the last one. Fixes shutdown problems when the PortMatrix has been opened during the session, during which PortRegisteredOrUnregistered is emitted quite heavily. git-svn-id: svn://localhost/ardour2/branches/3.0@6852 d708f5d6-7413-0410-9779-e7cbd77b26cf