{"action":"created","comment":{"url":"https://api.github.com/repos/opentx/opentx/pulls/comments/92858661","pull_request_review_id":13382627,"id":92858661,"diff_hunk":"@@ -113,11 +113,12 @@ class BaseLayoutFactory: public LayoutFactory\n     const ZoneOption * options;\n };\n \n-#define MAX_REGISTERED_LAYOUTS 10\n-\n-extern unsigned int countRegisteredLayouts;\n-extern const LayoutFactory * registeredLayouts[MAX_REGISTERED_LAYOUTS];\n Layout * loadLayout(const char * name, Layout::PersistentData * persistentData);\n void loadCustomScreens();\n \n+#define MAX_REGISTERED_LAYOUTS          10\n+extern unsigned int countRegisteredLayouts;\n+#define registeredLayouts      getRegisteredLayouts()\n+extern const LayoutFactory **  getRegisteredLayouts();","path":"radio/src/gui/480x272/layout.h","position":23,"original_position":23,"commit_id":"e707d9c58e6adfd8762534a9ea98998e234329b4","original_commit_id":"e707d9c58e6adfd8762534a9ea98998e234329b4","user":{"login":"bsongis","id":5603504,"avatar_url":"https://avatars.githubusercontent.com/u/5603504?v=3","gravatar_id":"","url":"https://api.github.com/users/bsongis","html_url":"https://github.com/bsongis","followers_url":"https://api.github.com/users/bsongis/followers","following_url":"https://api.github.com/users/bsongis/following{/other_user}","gists_url":"https://api.github.com/users/bsongis/gists{/gist_id}","starred_url":"https://api.github.com/users/bsongis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsongis/subscriptions","organizations_url":"https://api.github.com/users/bsongis/orgs","repos_url":"https://api.github.com/users/bsongis/repos","events_url":"https://api.github.com/users/bsongis/events{/privacy}","received_events_url":"https://api.github.com/users/bsongis/received_events","type":"User","site_admin":false},"body":"no extern here, we remove all of them little after little","created_at":"2016-12-16T18:12:28Z","updated_at":"2016-12-16T18:15:15Z","html_url":"https://github.com/opentx/opentx/pull/4141#discussion_r92858661","pull_request_url":"https://api.github.com/repos/opentx/opentx/pulls/4141","_links":{"self":{"href":"https://api.github.com/repos/opentx/opentx/pulls/comments/92858661"},"html":{"href":"https://github.com/opentx/opentx/pull/4141#discussion_r92858661"},"pull_request":{"href":"https://api.github.com/repos/opentx/opentx/pulls/4141"}}},"pull_request":{"url":"https://api.github.com/repos/opentx/opentx/pulls/4141","id":98321266,"html_url":"https://github.com/opentx/opentx/pull/4141","diff_url":"https://github.com/opentx/opentx/pull/4141.diff","patch_url":"https://github.com/opentx/opentx/pull/4141.patch","issue_url":"https://api.github.com/repos/opentx/opentx/issues/4141","number":4141,"state":"open","locked":false,"title":"Fix static initialization order problem with Horus GUI","user":{"login":"mpaperno","id":1366615,"avatar_url":"https://avatars.githubusercontent.com/u/1366615?v=3","gravatar_id":"","url":"https://api.github.com/users/mpaperno","html_url":"https://github.com/mpaperno","followers_url":"https://api.github.com/users/mpaperno/followers","following_url":"https://api.github.com/users/mpaperno/following{/other_user}","gists_url":"https://api.github.com/users/mpaperno/gists{/gist_id}","starred_url":"https://api.github.com/users/mpaperno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpaperno/subscriptions","organizations_url":"https://api.github.com/users/mpaperno/orgs","repos_url":"https://api.github.com/users/mpaperno/repos","events_url":"https://api.github.com/users/mpaperno/events{/privacy}","received_events_url":"https://api.github.com/users/mpaperno/received_events","type":"User","site_admin":false},"body":"Fixes static initialization order problem with Layout, Theme, & Widget factories.  I discovered this when building simu with MinGW-w64.  The initialization depended purely on compiler \"luck.\"\r\n\r\nSee [What’s the “static initialization order fiasco”?](https://isocpp.org/wiki/faq/ctors#static-init-order).\r\n\r\nFor example compare the registration order on Linux vs. Windows (from simu startup log):\r\n\r\nLinux g++4.9:\r\n```\r\n$ ./simulator22\r\nregister theme Darkblue\r\nregister theme Default\r\nregister layout Layout1x1\r\nregister layout Layout2P1\r\nregister layout Layout2x1\r\nregister layout Layout2x2\r\nregister layout Layout2x4\r\nregister widget Gauge\r\nregister widget ModelBmp\r\nregister widget Outputs\r\nregister widget Text\r\nregister widget Timer\r\nregister widget Value\r\nregistering \"opentx-horus\" simulator\r\n```\r\nWindows MinGW-w64 4.9 & 5.3\r\n```\r\n> simulator.exe\r\nregister widget Value\r\nregister widget Timer\r\nregister widget Text\r\nregister widget Outputs\r\nregister widget ModelBmp\r\nregister widget Gauge\r\nregister layout Layout2x4\r\nregister layout Layout2x2\r\nregister layout Layout2x1\r\nregister layout Layout2P1\r\nregister layout Layout1x1\r\nregister theme Default\r\nregister theme Darkblue\r\nregistering \"opentx-horus\" simulator\r\n```\r\n(Yes, the opposite... from same exact CMakeLists, compiler/linker options, and source code.)\r\n\r\nAnyway, the Horus simulator would crash hard when trying to register the first widget because the global `std::list <const WidgetFactory *> registeredWidgets` hadn't been initialized yet.  Took me a while to figure that one out!\r\n\r\nI've built this on Linux and Windows with several gcc versions, both firmware and simu.  But I have no actual Horus to test with.\r\n\r\nAs an aside, with some minor changes everything now builds and runs great using Qt5.5 or 5.7 with MinGW toolchains (and GNU Arm Embedded for the firmware, naturally).  The whole CMake project, including fw, can be configured, built, and edited from QtCreator with a stock Qt \"kit\" plus SDL and dirent downloads.  Coming up in a separate PR. \r\n\r\n-Max","created_at":"2016-12-16T11:43:00Z","updated_at":"2016-12-16T18:15:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c553eda07b95e1c9301fb3c887d2b2069894ccb","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/opentx/opentx/milestones/26","html_url":"https://github.com/opentx/opentx/milestone/26","labels_url":"https://api.github.com/repos/opentx/opentx/milestones/26/labels","id":1212574,"number":26,"title":"OpenTX 2.2.0","description":"","creator":{"login":"bsongis","id":5603504,"avatar_url":"https://avatars.githubusercontent.com/u/5603504?v=3","gravatar_id":"","url":"https://api.github.com/users/bsongis","html_url":"https://github.com/bsongis","followers_url":"https://api.github.com/users/bsongis/followers","following_url":"https://api.github.com/users/bsongis/following{/other_user}","gists_url":"https://api.github.com/users/bsongis/gists{/gist_id}","starred_url":"https://api.github.com/users/bsongis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bsongis/subscriptions","organizations_url":"https://api.github.com/users/bsongis/orgs","repos_url":"https://api.github.com/users/bsongis/repos","events_url":"https://api.github.com/users/bsongis/events{/privacy}","received_events_url":"https://api.github.com/users/bsongis/received_events","type":"User","site_admin":false},"open_issues":41,"closed_issues":165,"state":"open","created_at":"2015-07-17T09:24:35Z","updated_at":"2016-12-16T17:35:37Z","due_on":"2016-09-30T00:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/opentx/opentx/pulls/4141/commits","review_comments_url":"https://api.github.com/repos/opentx/opentx/pulls/4141/comments","review_comment_url":"https://api.github.com/repos/opentx/opentx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/opentx/opentx/issues/4141/comments","statuses_url":"https://api.github.com/repos/opentx/opentx/statuses/e707d9c58e6adfd8762534a9ea98998e234329b4","head":{"label":"mpaperno:static_init_fix","ref":"static_init_fix","sha":"e707d9c58e6adfd8762534a9ea98998e234329b4","user":{"login":"mpaperno","id":1366615,"avatar_url":"https://avatars.githubusercontent.com/u/1366615?v=3","gravatar_id":"","url":"https://api.github.com/users/mpaperno","html_url":"https://github.com/mpaperno","followers_url":"https://api.github.com/users/mpaperno/followers","following_url":"https://api.github.com/users/mpaperno/following{/other_user}","gists_url":"https://api.github.com/users/mpaperno/gists{/gist_id}","starred_url":"https://api.github.com/users/mpaperno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpaperno/subscriptions","organizations_url":"https://api.github.com/users/mpaperno/orgs","repos_url":"https://api.github.com/users/mpaperno/repos","events_url":"https://api.github.com/users/mpaperno/events{/privacy}","received_events_url":"https://api.github.com/users/mpaperno/received_events","type":"User","site_admin":false},"repo":{"id":33023631,"name":"opentx","full_name":"mpaperno/opentx","owner":{"login":"mpaperno","id":1366615,"avatar_url":"https://avatars.githubusercontent.com/u/1366615?v=3","gravatar_id":"","url":"https://api.github.com/users/mpaperno","html_url":"https://github.com/mpaperno","followers_url":"https://api.github.com/users/mpaperno/followers","following_url":"https://api.github.com/users/mpaperno/following{/other_user}","gists_url":"https://api.github.com/users/mpaperno/gists{/gist_id}","starred_url":"https://api.github.com/users/mpaperno/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpaperno/subscriptions","organizations_url":"https://api.github.com/users/mpaperno/orgs","repos_url":"https://api.github.com/users/mpaperno/repos","events_url":"https://api.github.com/users/mpaperno/events{/privacy}","received_events_url":"https://api.github.com/users/mpaperno/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mpaperno/opentx","description":"OpenTX custom firmware for Transmitters","fork":true,"url":"https://api.github.com/repos/mpaperno/opentx","forks_url":"https://api.github.com/repos/mpaperno/opentx/forks","keys_url":"https://api.github.com/repos/mpaperno/opentx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mpaperno/opentx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mpaperno/opentx/teams","hooks_url":"https://api.github.com/repos/mpaperno/opentx/hooks","issue_events_url":"https://api.github.com/repos/mpaperno/opentx/issues/events{/number}","events_url":"https://api.github.com/repos/mpaperno/opentx/events","assignees_url":"https://api.github.com/repos/mpaperno/opentx/assignees{/user}","branches_url":"https://api.github.com/repos/mpaperno/opentx/branches{/branch}","tags_url":"https://api.github.com/repos/mpaperno/opentx/tags","blobs_url":"https://api.github.com/repos/mpaperno/opentx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mpaperno/opentx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mpaperno/opentx/git/refs{/sha}","trees_url":"https://api.github.com/repos/mpaperno/opentx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mpaperno/opentx/statuses/{sha}","languages_url":"https://api.github.com/repos/mpaperno/opentx/languages","stargazers_url":"https://api.github.com/repos/mpaperno/opentx/stargazers","contributors_url":"https://api.github.com/repos/mpaperno/opentx/contributors","subscribers_url":"https://api.github.com/repos/mpaperno/opentx/subscribers","subscription_url":"https://api.github.com/repos/mpaperno/opentx/subscription","commits_url":"https://api.github.com/repos/mpaperno/opentx/commits{/sha}","git_commits_url":"https://api.github.com/repos/mpaperno/opentx/git/commits{/sha}","comments_url":"https://api.github.com/repos/mpaperno/opentx/comments{/number}","issue_comment_url":"https://api.github.com/repos/mpaperno/opentx/issues/comments{/number}","contents_url":"https://api.github.com/repos/mpaperno/opentx/contents/{+path}","compare_url":"https://api.github.com/repos/mpaperno/opentx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mpaperno/opentx/merges","archive_url":"https://api.github.com/repos/mpaperno/opentx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mpaperno/opentx/downloads","issues_url":"https://api.github.com/repos/mpaperno/opentx/issues{/number}","pulls_url":"https://api.github.com/repos/mpaperno/opentx/pulls{/number}","milestones_url":"https://api.github.com/repos/mpaperno/opentx/milestones{/number}","notifications_url":"https://api.github.com/repos/mpaperno/opentx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mpaperno/opentx/labels{/name}","releases_url":"https://api.github.com/repos/mpaperno/opentx/releases{/id}","deployments_url":"https://api.github.com/repos/mpaperno/opentx/deployments","created_at":"2015-03-28T06:34:10Z","updated_at":"2015-03-28T06:34:15Z","pushed_at":"2016-12-16T13:50:54Z","git_url":"git://github.com/mpaperno/opentx.git","ssh_url":"git@github.com:mpaperno/opentx.git","clone_url":"https://github.com/mpaperno/opentx.git","svn_url":"https://github.com/mpaperno/opentx","homepage":"","size":136298,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"opentx:next","ref":"next","sha":"d35736732bcbe4c2574f19fa5448a5aba1871af1","user":{"login":"opentx","id":6073522,"avatar_url":"https://avatars.githubusercontent.com/u/6073522?v=3","gravatar_id":"","url":"https://api.github.com/users/opentx","html_url":"https://github.com/opentx","followers_url":"https://api.github.com/users/opentx/followers","following_url":"https://api.github.com/users/opentx/following{/other_user}","gists_url":"https://api.github.com/users/opentx/gists{/gist_id}","starred_url":"https://api.github.com/users/opentx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentx/subscriptions","organizations_url":"https://api.github.com/users/opentx/orgs","repos_url":"https://api.github.com/users/opentx/repos","events_url":"https://api.github.com/users/opentx/events{/privacy}","received_events_url":"https://api.github.com/users/opentx/received_events","type":"Organization","site_admin":false},"repo":{"id":14794708,"name":"opentx","full_name":"opentx/opentx","owner":{"login":"opentx","id":6073522,"avatar_url":"https://avatars.githubusercontent.com/u/6073522?v=3","gravatar_id":"","url":"https://api.github.com/users/opentx","html_url":"https://github.com/opentx","followers_url":"https://api.github.com/users/opentx/followers","following_url":"https://api.github.com/users/opentx/following{/other_user}","gists_url":"https://api.github.com/users/opentx/gists{/gist_id}","starred_url":"https://api.github.com/users/opentx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opentx/subscriptions","organizations_url":"https://api.github.com/users/opentx/orgs","repos_url":"https://api.github.com/users/opentx/repos","events_url":"https://api.github.com/users/opentx/events{/privacy}","received_events_url":"https://api.github.com/users/opentx/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/opentx/opentx","description":"OpenTX custom firmware for Transmitters","fork":false,"url":"https://api.github.com/repos/opentx/opentx","forks_url":"https://api.github.com/repos/opentx/opentx/forks","keys_url":"https://api.github.com/repos/opentx/opentx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opentx/opentx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opentx/opentx/teams","hooks_url":"https://api.github.com/repos/opentx/opentx/hooks","issue_events_url":"https://api.github.com/repos/opentx/opentx/issues/events{/number}","events_url":"https://api.github.com/repos/opentx/opentx/events","assignees_url":"https://api.github.com/repos/opentx/opentx/assignees{/user}","branches_url":"https://api.github.com/repos/opentx/opentx/branches{/branch}","tags_url":"https://api.github.com/repos/opentx/opentx/tags","blobs_url":"https://api.github.com/repos/opentx/opentx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opentx/opentx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opentx/opentx/git/refs{/sha}","trees_url":"https://api.github.com/repos/opentx/opentx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opentx/opentx/statuses/{sha}","languages_url":"https://api.github.com/repos/opentx/opentx/languages","stargazers_url":"https://api.github.com/repos/opentx/opentx/stargazers","contributors_url":"https://api.github.com/repos/opentx/opentx/contributors","subscribers_url":"https://api.github.com/repos/opentx/opentx/subscribers","subscription_url":"https://api.github.com/repos/opentx/opentx/subscription","commits_url":"https://api.github.com/repos/opentx/opentx/commits{/sha}","git_commits_url":"https://api.github.com/repos/opentx/opentx/git/commits{/sha}","comments_url":"https://api.github.com/repos/opentx/opentx/comments{/number}","issue_comment_url":"https://api.github.com/repos/opentx/opentx/issues/comments{/number}","contents_url":"https://api.github.com/repos/opentx/opentx/contents/{+path}","compare_url":"https://api.github.com/repos/opentx/opentx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opentx/opentx/merges","archive_url":"https://api.github.com/repos/opentx/opentx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opentx/opentx/downloads","issues_url":"https://api.github.com/repos/opentx/opentx/issues{/number}","pulls_url":"https://api.github.com/repos/opentx/opentx/pulls{/number}","milestones_url":"https://api.github.com/repos/opentx/opentx/milestones{/number}","notifications_url":"https://api.github.com/repos/opentx/opentx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opentx/opentx/labels{/name}","releases_url":"https://api.github.com/repos/opentx/opentx/releases{/id}","deployments_url":"https://api.github.com/repos/opentx/opentx/deployments","created_at":"2013-11-29T07:02:56Z","updated_at":"2016-12-15T21:05:05Z","pushed_at":"2016-12-16T17:52:53Z","git_url":"git://github.com/opentx/opentx.git","ssh_url":"git@github.com:opentx/opentx.git","clone_url":"https://github.com/opentx/opentx.git","svn_url":"https://github.com/opentx/opentx","homepage":"","size":137416,"stargazers_count":480,"watchers_count":480,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":278,"mirror_url":null,"open_issues_count":473,"forks":278,"open_issues":473,"watchers":480,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/opentx/opentx/pulls/4141"},"html":{"href":"https://github.com/opentx/opentx/pull/4141"},"issue":{"href":"https://api.github.com/repos/opentx/opentx/issues/4141"},"comments":{"href":"https://api.github.com/repos/opentx/opentx/issues/4141/comments"},"review_comments":{"href":"https://api.github.com/repos/opentx/opentx/pulls/4141/comments"},"review_comment":{"href":"https://api.github.com/repos/opentx/opentx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/opentx/opentx/pulls/4141/commits"},"statuses":{"href":"https://api.github.com/repos/opentx/opentx/statuses/e707d9c58e6adfd8762534a9ea98998e234329b4"}}}}
{"actor":{"display_login":"bsongis"}}