{"action":"created","issue":{"url":"https://api.github.com/repos/solettaproject/soletta/issues/1500","repository_url":"https://api.github.com/repos/solettaproject/soletta","labels_url":"https://api.github.com/repos/solettaproject/soletta/issues/1500/labels{/name}","comments_url":"https://api.github.com/repos/solettaproject/soletta/issues/1500/comments","events_url":"https://api.github.com/repos/solettaproject/soletta/issues/1500/events","html_url":"https://github.com/solettaproject/soletta/pull/1500","id":137348094,"number":1500,"title":"Sol-monitors: Fix infinite loop while iterating over a sol-monitor ca…","user":{"login":"cabelitos","id":984610,"avatar_url":"https://avatars.githubusercontent.com/u/984610?v=3","gravatar_id":"","url":"https://api.github.com/users/cabelitos","html_url":"https://github.com/cabelitos","followers_url":"https://api.github.com/users/cabelitos/followers","following_url":"https://api.github.com/users/cabelitos/following{/other_user}","gists_url":"https://api.github.com/users/cabelitos/gists{/gist_id}","starred_url":"https://api.github.com/users/cabelitos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cabelitos/subscriptions","organizations_url":"https://api.github.com/users/cabelitos/orgs","repos_url":"https://api.github.com/users/cabelitos/repos","events_url":"https://api.github.com/users/cabelitos/events{/privacy}","received_events_url":"https://api.github.com/users/cabelitos/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-29T19:30:21Z","updated_at":"2016-02-29T21:16:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/solettaproject/soletta/pulls/1500","html_url":"https://github.com/solettaproject/soletta/pull/1500","diff_url":"https://github.com/solettaproject/soletta/pull/1500.diff","patch_url":"https://github.com/solettaproject/soletta/pull/1500.patch"},"body":"…llbacks.\r\n\r\nThe following code would lead soletta to an infinite loop:\r\n\r\nstatic void\r\nmy_monitor_cb(void *data)\r\n{\r\n    struct sol_monitors *ms = data;\r\n\r\n    sol_monitors_append(my_monitor_cb, ms);\r\n}\r\n\r\n// C code...\r\n\r\nSOL_MONITORS_WALK(sol_monitor, cb, i)\r\n\tcb(sol_monitor);\r\n\r\n//More C code...\r\n\r\nThis happens because sol_monitors_append() does not care if\r\nthe sol_monitor is walking. In order to prevent an infinite\r\nloop, __SOL_MONITORS_WALK() should save how many monitors\r\nare registered before the walk starts and walk until that number is reached.\r\n\r\nSigned-off-by: Guilherme Iscaro <guilherme.iscaro@intel.com>"},"comment":{"url":"https://api.github.com/repos/solettaproject/soletta/issues/comments/190400655","html_url":"https://github.com/solettaproject/soletta/pull/1500#issuecomment-190400655","issue_url":"https://api.github.com/repos/solettaproject/soletta/issues/1500","id":190400655,"user":{"login":"barbieri","id":1838,"avatar_url":"https://avatars.githubusercontent.com/u/1838?v=3","gravatar_id":"","url":"https://api.github.com/users/barbieri","html_url":"https://github.com/barbieri","followers_url":"https://api.github.com/users/barbieri/followers","following_url":"https://api.github.com/users/barbieri/following{/other_user}","gists_url":"https://api.github.com/users/barbieri/gists{/gist_id}","starred_url":"https://api.github.com/users/barbieri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/barbieri/subscriptions","organizations_url":"https://api.github.com/users/barbieri/orgs","repos_url":"https://api.github.com/users/barbieri/repos","events_url":"https://api.github.com/users/barbieri/events{/privacy}","received_events_url":"https://api.github.com/users/barbieri/received_events","type":"User","site_admin":false},"created_at":"2016-02-29T21:16:40Z","updated_at":"2016-02-29T21:16:40Z","body":"+1\r\n\r\nand as @gabrielschulhof said, add this as a unit test"}}