{"action":"created","issue":{"url":"https://api.github.com/repos/LMMS/lmms/issues/2252","labels_url":"https://api.github.com/repos/LMMS/lmms/issues/2252/labels{/name}","comments_url":"https://api.github.com/repos/LMMS/lmms/issues/2252/comments","events_url":"https://api.github.com/repos/LMMS/lmms/issues/2252/events","html_url":"https://github.com/LMMS/lmms/pull/2252","id":100462078,"number":2252,"title":"Use OSC Messaging to avoid calling QMessageBox from the core","user":{"login":"Wallacoloo","id":1210751,"avatar_url":"https://avatars.githubusercontent.com/u/1210751?v=3","gravatar_id":"","url":"https://api.github.com/users/Wallacoloo","html_url":"https://github.com/Wallacoloo","followers_url":"https://api.github.com/users/Wallacoloo/followers","following_url":"https://api.github.com/users/Wallacoloo/following{/other_user}","gists_url":"https://api.github.com/users/Wallacoloo/gists{/gist_id}","starred_url":"https://api.github.com/users/Wallacoloo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wallacoloo/subscriptions","organizations_url":"https://api.github.com/users/Wallacoloo/orgs","repos_url":"https://api.github.com/users/Wallacoloo/repos","events_url":"https://api.github.com/users/Wallacoloo/events{/privacy}","received_events_url":"https://api.github.com/users/Wallacoloo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-08-12T04:23:36Z","updated_at":"2015-08-26T02:31:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/LMMS/lmms/pulls/2252","html_url":"https://github.com/LMMS/lmms/pull/2252","diff_url":"https://github.com/LMMS/lmms/pull/2252.diff","patch_url":"https://github.com/LMMS/lmms/pull/2252.patch"},"body":"This implements two new classes: core/Messenger.cpp and core/OscMsgListener.cpp with the goal of reducing the coupling between the core & gui.\r\n\r\nThe former class allows any thread to broadcast a message to a number of OscMsgListeners in a thread-safe manner, using Open Sound Control for the underlying format & @fundamental 's rtosc library. Upon broadcast, messages are added to a queue, where the listener thread later dequeues & processes them. It is not a lock-free implementation, but no user/callback code is ever run while the queue is locked, so deadlocks are impossible & it's relatively low-latency (better than having the core directly call into unknown gui functions, in any case). If anybody finds a good lock-free queue and set implementation, they could be dropped in and this is solved.\r\n\r\nCurrently, the only two forms of communication this new system is used for is broadcasting initialization messages (i.e. splash-screen status updates) & warning/error messages. It behaves nearly identically to current master, but the core no longer has a single usage of `QMessageBox` - the QMessageBoxes are instantiated in gui/GuiApplication.cpp instead. The differences are:\r\n\r\n- Initialization messages arising inside Engine::init() aren't processed until after Engine::init() returns, which means there are no splash screen updates for the first few seconds. This is because Engine::init() actually still initializes portions of the GUI and therefore must be run in the gui thread, thereby blocking gui updates.\r\n\r\n- Error messages when opening a project through the command line are not displayed to the terminal. Previously, they were selectively routed to a QMessageBox::Warning or stderr based on if the gui existed. They could be added back in by implementing OscMsgListener in core/main.cpp or another file that logs error messages to the console.\r\n\r\n--------\r\nFeedback is appreciated. Although this looks like a large PR, that's mainly due to the addition of rtosc to the source tree. The end goal is in having the gui manipulate the core only through OSC commands & never by directly calling into it, but a lot needs to happen before that's feasible.\r\n\r\nNote: this fixes the following issues:\r\n* #2269 (and its several duplicates)\r\n* #2245"},"comment":{"url":"https://api.github.com/repos/LMMS/lmms/issues/comments/134796054","html_url":"https://github.com/LMMS/lmms/pull/2252#issuecomment-134796054","issue_url":"https://api.github.com/repos/LMMS/lmms/issues/2252","id":134796054,"user":{"login":"fundamental","id":766621,"avatar_url":"https://avatars.githubusercontent.com/u/766621?v=3","gravatar_id":"","url":"https://api.github.com/users/fundamental","html_url":"https://github.com/fundamental","followers_url":"https://api.github.com/users/fundamental/followers","following_url":"https://api.github.com/users/fundamental/following{/other_user}","gists_url":"https://api.github.com/users/fundamental/gists{/gist_id}","starred_url":"https://api.github.com/users/fundamental/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fundamental/subscriptions","organizations_url":"https://api.github.com/users/fundamental/orgs","repos_url":"https://api.github.com/users/fundamental/repos","events_url":"https://api.github.com/users/fundamental/events{/privacy}","received_events_url":"https://api.github.com/users/fundamental/received_events","type":"User","site_admin":false},"created_at":"2015-08-26T02:31:36Z","updated_at":"2015-08-26T02:31:36Z","body":"@Wallacoloo I think you just attached those commits to the wrong pull request. They look like they belong to #2289"}}