{"action":"created","issue":{"url":"https://api.github.com/repos/VCVRack/Rack/issues/954","repository_url":"https://api.github.com/repos/VCVRack/Rack","labels_url":"https://api.github.com/repos/VCVRack/Rack/issues/954/labels{/name}","comments_url":"https://api.github.com/repos/VCVRack/Rack/issues/954/comments","events_url":"https://api.github.com/repos/VCVRack/Rack/issues/954/events","html_url":"https://github.com/VCVRack/Rack/issues/954","id":322560535,"number":954,"title":"odd division by zero crash","user":{"login":"alto777","id":8083797,"avatar_url":"https://avatars3.githubusercontent.com/u/8083797?v=4","gravatar_id":"","url":"https://api.github.com/users/alto777","html_url":"https://github.com/alto777","followers_url":"https://api.github.com/users/alto777/followers","following_url":"https://api.github.com/users/alto777/following{/other_user}","gists_url":"https://api.github.com/users/alto777/gists{/gist_id}","starred_url":"https://api.github.com/users/alto777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alto777/subscriptions","organizations_url":"https://api.github.com/users/alto777/orgs","repos_url":"https://api.github.com/users/alto777/repos","events_url":"https://api.github.com/users/alto777/events{/privacy}","received_events_url":"https://api.github.com/users/alto777/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-05-13T03:25:06Z","updated_at":"2018-05-13T15:04:23Z","closed_at":null,"author_association":"NONE","body":"Sifting through the debris of a Rack crash led me to look for division by zero. My module, my thread, my step function. I had no division! I finally figured out that '%' might could be it, and yes, commenting out that line relieved the crashing on module addition.\r\n\r\nGuarding that line allows the addition and perfect use of the module. This is the knob, nothing special, it should only give 1.0 to 16.0:\r\n\r\n\t\taddParam(ParamWidget::create<Davies1900hBlackKnob>(Vec(58, 187), module, NameMe::RING_SIZE_PARAM, 1.0, 16.0, 7.0));\t/* number in ring */\r\n\r\n\r\nIn my step I get its value, which seemed to be (in the modulo expression) causing division by zero. In desperation I tacked on an info call to see:\r\n\r\n\tringSize = roundf(params[RING_SIZE_PARAM].value);\r\n\tif (ringSize == 0) info(\"WTF - ringSize _is_ zero!\");\r\n\r\n\r\nThe log is littered with \"ringSize_is_zero\" messages for 6 milliseconds around the time my module is added to the rack.\r\n\r\nImma going to sleep on this but ATM it looks like the step function is called when the param objects are not yet operating. If so, this would have implications beyond the show-stopper I ran into. If not, I do not understand."},"comment":{"url":"https://api.github.com/repos/VCVRack/Rack/issues/comments/388633594","html_url":"https://github.com/VCVRack/Rack/issues/954#issuecomment-388633594","issue_url":"https://api.github.com/repos/VCVRack/Rack/issues/954","id":388633594,"user":{"login":"alto777","id":8083797,"avatar_url":"https://avatars3.githubusercontent.com/u/8083797?v=4","gravatar_id":"","url":"https://api.github.com/users/alto777","html_url":"https://github.com/alto777","followers_url":"https://api.github.com/users/alto777/followers","following_url":"https://api.github.com/users/alto777/following{/other_user}","gists_url":"https://api.github.com/users/alto777/gists{/gist_id}","starred_url":"https://api.github.com/users/alto777/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alto777/subscriptions","organizations_url":"https://api.github.com/users/alto777/orgs","repos_url":"https://api.github.com/users/alto777/repos","events_url":"https://api.github.com/users/alto777/events{/privacy}","received_events_url":"https://api.github.com/users/alto777/received_events","type":"User","site_admin":false},"created_at":"2018-05-13T15:04:23Z","updated_at":"2018-05-13T15:04:23Z","author_association":"NONE","body":"Thank you, I see. I think other problems might not be, that is I hope any draw() overriden calls, for example, are done when the widgets are all done. Creating.\r\n\r\nSo what is the solution? It may be naive, but it seems odd to be calling the step function before use of params[..].value is valid. As I see it this could make for all kindsa interesting behaviour on module instantiation.\r\n\r\nOn the other hand, it also seems odd to guard uses of params[..].value with fixes to the possibilty that out-of-expected range numbers are retrieved.\r\n\r\nOn the other hand (I know, third hand) it seems like one could just cut out of the step function at its top for the first, what, 20 milliseconds? Or is there a better way to ensure that all the construction dust has settled, so to speak? I don't see anyone doing anything like this, but I cannot believe that I am the first to be distracted by this timing/startup issue.\r\n\r\na7\r\n"}}
{"actor":{"display_login":"alto777"}}