x/mobile: app.pump() will eventually crash #13230
Comments
That's fair. Note to anyone who wants to fix this: there's a second copy of the code in x/exp/shiny/driver/internal/pump/pump.go. Ideally we would start by fixing that, and then copying that code over as x/mobile/internal/pump/pump.go, so that it's easier to keep them in sync in the future. |
Sorry, I know this is border line OCD, I'll submit a CL. Regarding the fix, does anyone have a better idea than the obvious
? |
Most of the modulo arithmetic survives through overflow. The only part I haven't thought through carefully is Can you first construct some example values where this code fails? |
Woops, forget it, I got modulo (%) mixed up with the fast modulo performed with |
The i and j counters are never reset if the buffer is never expanded and will eventually reach MAXINT. This may seem overzealous since on a 32 bits system, this can take from a couple of months to over a year depending on the amount of events. Some applications like public information screens can however be expected to run for longer than that.
The text was updated successfully, but these errors were encountered: