shiny/driver/mtldriver: select on receiving from newWindowCh

This is a fixup to CL 208877. The intention there was to select
between receiving a value from the newWindowCh or done channels.
Instead, it was receiving only on the newWindowCh channel,
before proceeding to select between sending to newWindowCh
and receiving from done. That means a shiny program that doesn't
open a window could never exit. This change fixes that.

Change-Id: I1c09ea5f7bec6c9714f20428fdd90d1b756f515d
Reviewed-by: Brad Fitzpatrick <>
diff --git a/shiny/driver/mtldriver/mtldriver.go b/shiny/driver/mtldriver/mtldriver.go
index 8b50b22..2c0e3c4 100644
--- a/shiny/driver/mtldriver/mtldriver.go
+++ b/shiny/driver/mtldriver/mtldriver.go
@@ -71,7 +71,8 @@
 	// TODO(dmitshur): Delete this when is resolved.
 	// Wait for first window request (or done) before entering main
 	// loop to work around
-	case newWindowCh <- <-newWindowCh:
+	case w := <-newWindowCh:
+		newWindowCh <- w
 	case <-done:
 	for {