Ok, so after a little digging and trying to run some scripts to resize windows back on screen (that I found on stackoverflow superuser) I noticed that when the problem occurs I get a new process in Activity Monitor called 'ReportCrash'.
So, looks like there's some kind of error capturing process going on here and this is reported in console each time it happens:
12/05/2016 11:16:05.478 ReportCrash[1718]: Unable to find containing app bundle for /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/PlugIns/ShareMa il.appex/Contents/MacOS/ShareMail. Will not read AppStore receipt
12/05/2016 11:16:06.545 ReportCrash[1718]: Invalid connection: com.apple.coresymbolicationd
12/05/2016 11:16:09.989 ReportCrash[1718]: Saved crash report for ShareMail[1717] version 1.0 (454.21) to /Users/xxx/Library/Logs/DiagnosticReports/ShareMail_2016-05-12-111609_MacBook-P ro-2.crash
12/05/2016 11:18:24.860 com.apple.xpc.launchd[1]: (com.apple.ReportCrash[1759]) Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.ReportCrash
and:
12/05/2016 11:18:24.869 ReportCrash[1759]: Unable to find containing app bundle for /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/PlugIns/Faceboo kPost.appex/Contents/MacOS/FacebookPost. Will not read AppStore receipt
12/05/2016 11:18:25.971 ReportCrash[1759]: Invalid connection: com.apple.coresymbolicationd
12/05/2016 11:18:29.508 ReportCrash[1759]: Saved crash report for FacebookPost[1757] version 1.0 (454.21) to /Users/oliver/Library/Logs/DiagnosticReports/FacebookPost_2016-05-12-111829_Mac Book-Pro-2.crash
So I googled "Will not read AppStore receipt" and found this apple support thread that points to this apple support document for users who have just upgraded to El capitan. This doesn't include me as I am on a new (as of October) rMBP. and I'm not sure whether to risk running it or not:
Follow these steps if the issue occured immediately after upgrading to Yosemite or El Capitan.
- Open the Terminal app, which is in the Utilities folder of your Applications folder.
- Type this command in Terminal:/System/Library/Frameworks/CoreServices.framework/Versions/A/Framework s/LaunchServices.framework/Versions/A/Support/lsregister -kill -seed
- Press Return and wait for the Terminal prompt—which ends in $—to reappear. It may take a few minutes.
- Quit Terminal.
Hmmm.