| 1 | //go:build windows |
| 2 | |
| 3 | package main |
| 4 | |
| 5 | import "testing" |
| 6 | |
| 7 | func TestCurrentProcessTopLevelWindowReusesEnumCallback(t *testing.T) { |
| 8 | if enumWindowsCallback == 0 { |
| 9 | t.Fatal("EnumWindows callback was not registered") |
| 10 | } |
| 11 | |
| 12 | // Go's Windows runtime currently supports a finite callback table. The old |
| 13 | // implementation allocated one callback per poll and exhausted that table |
| 14 | // during a normal long-running session. |
| 15 | for i := 0; i < 2100; i++ { |
| 16 | _ = currentProcessTopLevelWindow() |
| 17 | } |
| 18 | } |
| 19 |