prevent registering multiple identical file descriptors

fix indentation

fix more indentation
This commit is contained in:
Cameron 2021-02-26 00:34:22 -08:00 committed by Robin Gareus
parent 74670d2789
commit c075d3a026
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
1 changed files with 4 additions and 0 deletions

View File

@ -104,6 +104,10 @@ public:
/* VST3 IRunLoop interface */
tresult registerEventHandler (Linux::IEventHandler* handler, FileDescriptor fd) SMTG_OVERRIDE
{
if (!handler || _event_handlers.find(fd) != _event_handlers.end()) {
return kInvalidArgument;
}
Glib::Threads::Mutex::Lock lm (_lock);
GIOChannel* gio_channel = g_io_channel_unix_new (fd);
guint id = g_io_add_watch (gio_channel, (GIOCondition) (G_IO_IN /*| G_IO_OUT*/ | G_IO_ERR | G_IO_HUP), event, handler);