libpbd/guis: move __invalidator() into PBD::EventLoop
we allow use of/dependency on sigc::trackable there, so this is both legal but also sensible. Leave the macro definition of invalidator(x) in gtkmm2ext/gui_thread.h because it doesn't hurt and makes some sense for it to be there. No reason for a source module that needs invalidator(x) to load EventLoop decl.
This commit is contained in:
parent
f5f48b421e
commit
d5ad9ff033
@ -456,23 +456,6 @@ UI::idle_add (int (*func)(void *), void *arg)
|
|||||||
|
|
||||||
/* END abstract_ui interfaces */
|
/* END abstract_ui interfaces */
|
||||||
|
|
||||||
/** Create a PBD::EventLoop::InvalidationRecord and attach a callback
|
|
||||||
* to a given sigc::trackable so that PBD::EventLoop::invalidate_request
|
|
||||||
* is called when that trackable is destroyed.
|
|
||||||
*/
|
|
||||||
PBD::EventLoop::InvalidationRecord*
|
|
||||||
__invalidator (sigc::trackable& trackable, const char* file, int line)
|
|
||||||
{
|
|
||||||
PBD::EventLoop::InvalidationRecord* ir = new PBD::EventLoop::InvalidationRecord;
|
|
||||||
|
|
||||||
ir->file = file;
|
|
||||||
ir->line = line;
|
|
||||||
|
|
||||||
trackable.add_destroy_notify_callback (ir, PBD::EventLoop::invalidate_request);
|
|
||||||
|
|
||||||
return ir;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
UI::do_request (UIRequest* req)
|
UI::do_request (UIRequest* req)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +35,6 @@ namespace sigc {
|
|||||||
#define gui_context() Gtkmm2ext::UI::instance() /* a UICallback-derived object that specifies the event loop for GUI signal handling */
|
#define gui_context() Gtkmm2ext::UI::instance() /* a UICallback-derived object that specifies the event loop for GUI signal handling */
|
||||||
#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__))
|
#define ui_bind(f, ...) boost::protect (boost::bind (f, __VA_ARGS__))
|
||||||
|
|
||||||
LIBGTKMM2EXT_API extern PBD::EventLoop::InvalidationRecord* __invalidator (sigc::trackable& trackable, const char*, int);
|
#define invalidator(x) PBD::EventLoop::__invalidator ((x), __FILE__, __LINE__)
|
||||||
#define invalidator(x) __invalidator ((x), __FILE__, __LINE__)
|
|
||||||
|
|
||||||
#endif /* __ardour_gtk_gui_thread_h__ */
|
#endif /* __ardour_gtk_gui_thread_h__ */
|
||||||
|
@ -109,6 +109,24 @@ EventLoop::invalidate_request (void* data)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Create a PBD::EventLoop::InvalidationRecord and attach a callback
|
||||||
|
* to a given sigc::trackable so that PBD::EventLoop::invalidate_request
|
||||||
|
* is called when that trackable is destroyed.
|
||||||
|
*/
|
||||||
|
EventLoop::InvalidationRecord*
|
||||||
|
EventLoop::__invalidator (sigc::trackable& trackable, const char* file, int line)
|
||||||
|
{
|
||||||
|
PBD::EventLoop::InvalidationRecord* ir = new PBD::EventLoop::InvalidationRecord;
|
||||||
|
|
||||||
|
ir->file = file;
|
||||||
|
ir->line = line;
|
||||||
|
|
||||||
|
trackable.add_destroy_notify_callback (ir, PBD::EventLoop::invalidate_request);
|
||||||
|
|
||||||
|
return ir;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
vector<EventLoop::ThreadBufferMapping>
|
vector<EventLoop::ThreadBufferMapping>
|
||||||
EventLoop::get_request_buffers_for_target_thread (const std::string& target_thread)
|
EventLoop::get_request_buffers_for_target_thread (const std::string& target_thread)
|
||||||
{
|
{
|
||||||
@ -197,3 +215,4 @@ EventLoop::remove_request_buffer_from_map (pthread_t pth)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,8 @@ public:
|
|||||||
|
|
||||||
std::list<InvalidationRecord*> trash;
|
std::list<InvalidationRecord*> trash;
|
||||||
|
|
||||||
|
static InvalidationRecord* __invalidator (sigc::trackable& trackable, const char*, int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static Glib::Threads::Private<EventLoop> thread_event_loop;
|
static Glib::Threads::Private<EventLoop> thread_event_loop;
|
||||||
std::string _name;
|
std::string _name;
|
||||||
@ -136,6 +138,6 @@ private:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MISSING_INVALIDATOR 0 // used to mark places where we fail to provide an invalidator
|
#define MISSING_INVALIDATOR nullptr // used to mark places where we fail to provide an invalidator
|
||||||
|
|
||||||
#endif /* __pbd_event_loop_h__ */
|
#endif /* __pbd_event_loop_h__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user