{"action":"created","issue":{"url":"https://api.github.com/repos/LMMS/lmms/issues/2669","repository_url":"https://api.github.com/repos/LMMS/lmms","labels_url":"https://api.github.com/repos/LMMS/lmms/issues/2669/labels{/name}","comments_url":"https://api.github.com/repos/LMMS/lmms/issues/2669/comments","events_url":"https://api.github.com/repos/LMMS/lmms/issues/2669/events","html_url":"https://github.com/LMMS/lmms/pull/2669","id":140220057,"number":2669,"title":"Replace every use of the foreach macro with a C++11 range-based for loop","user":{"login":"Fastigium","id":10221829,"avatar_url":"https://avatars.githubusercontent.com/u/10221829?v=3","gravatar_id":"","url":"https://api.github.com/users/Fastigium","html_url":"https://github.com/Fastigium","followers_url":"https://api.github.com/users/Fastigium/followers","following_url":"https://api.github.com/users/Fastigium/following{/other_user}","gists_url":"https://api.github.com/users/Fastigium/gists{/gist_id}","starred_url":"https://api.github.com/users/Fastigium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fastigium/subscriptions","organizations_url":"https://api.github.com/users/Fastigium/orgs","repos_url":"https://api.github.com/users/Fastigium/repos","events_url":"https://api.github.com/users/Fastigium/events{/privacy}","received_events_url":"https://api.github.com/users/Fastigium/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-11T15:56:00Z","updated_at":"2016-03-11T18:44:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/LMMS/lmms/pulls/2669","html_url":"https://github.com/LMMS/lmms/pull/2669","diff_url":"https://github.com/LMMS/lmms/pull/2669.diff","patch_url":"https://github.com/LMMS/lmms/pull/2669.patch"},"body":"Feedback on the `CMakeLists.txt` changes, please! I don't know how to do that right. Plus things aren't const correct everywhere. Otherwise, this PR should be as good as #2658, and even doesn't exhibit #2659 :blush:\r\n\r\nMain commit message:\r\n```\r\nThis prevents a race condition with Qt5. A foreach loop makes a copy of its\r\nQt container, increasing the reference count to the container's internal\r\ndata. Qt5 often asserts isDetached(), which requires the reference count to\r\nbe <= 1. This assertion fails when the foreach loop increases the reference\r\ncount at exactly the wrong moment. Using a range-based for loop prevents an\r\nunnecessary copy from being made and ensures this race condition isn't\r\ntriggered.\r\n```"},"comment":{"url":"https://api.github.com/repos/LMMS/lmms/issues/comments/195494010","html_url":"https://github.com/LMMS/lmms/pull/2669#issuecomment-195494010","issue_url":"https://api.github.com/repos/LMMS/lmms/issues/2669","id":195494010,"user":{"login":"Fastigium","id":10221829,"avatar_url":"https://avatars.githubusercontent.com/u/10221829?v=3","gravatar_id":"","url":"https://api.github.com/users/Fastigium","html_url":"https://github.com/Fastigium","followers_url":"https://api.github.com/users/Fastigium/followers","following_url":"https://api.github.com/users/Fastigium/following{/other_user}","gists_url":"https://api.github.com/users/Fastigium/gists{/gist_id}","starred_url":"https://api.github.com/users/Fastigium/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fastigium/subscriptions","organizations_url":"https://api.github.com/users/Fastigium/orgs","repos_url":"https://api.github.com/users/Fastigium/repos","events_url":"https://api.github.com/users/Fastigium/events{/privacy}","received_events_url":"https://api.github.com/users/Fastigium/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T18:44:23Z","updated_at":"2016-03-11T18:44:23Z","body":"@tresf It won't compile otherwise, as I replaced some foreach loops in `plugins/`. But it turns out I broke something else as well while incorporating michaelgregorius's suggestions, let me look at that..."}}