The same problem with a Macbook pro mid 2014 bought a month ago (disabling the swith all is working).
I can experience the issue using javafx of swing library in java.
Spent many time with phone/mail assistence with no result. The only solution for apple assitence is to reinstall the whole system from scratch with no further explanation. And install one application at a time. The problem for me is that the bus is not easily reproducible. I am working on a test-case.
A week ago I went to an apple store, they changed my motherboard (assuring that the old one is damaged and the new is ok) but nothing is changed, randomly (not all the times) when i launch a java application that uses javafx or swing (requires graphic card switch) the system hangs.
I am waithing for an external disk to do some further testing. Very disappointed from apple assistence.