<!--  As an open source project with a dedicated but small maintainer team, it can sometimes take a long time for issues to be addressed so please be patient and we will get back to you as soon as we can.
-->

### Preflight Checklist
<!-- Please ensure you've completed the following steps by replacing [ ] with [x]-->

* [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.
* [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.
* [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.

### Issue Details

* **Electron Version:**
  * <!-- (output of `node_modules/.bin/electron --version`) e.g. 4.0.3 --> 7.1.7 (32-bit and 64-bit) as well as 8.X
* **Operating System:**
  * <!-- (Platform and Version) e.g. macOS 10.13.6 / Windows 10 (1803) / Ubuntu 18.04 x64 --> Windows 10 18362
* **Last Known Working Electron version:**
  * <!-- (if applicable) e.g. 3.1.0 --> 6.1.6 (32-bit)

### Expected Behavior
<!-- A clear and concise description of what you expected to happen. -->
The application should not crash when showing a hidden window.

### Actual Behavior
<!-- A clear and concise description of what actually happened. -->
It crashes consistently.

### To Reproduce
<!--
Your best chance of getting this bug looked at quickly is to provide an example.
-->

<!--
For bugs that can be encapsulated in a small experiment, you can use Electron Fiddle (https://github.com/electron/fiddle) to publish your example to a GitHub Gist and link it your bug report.
-->

<!--
If Fiddle is insufficient to produce an example, please provide an example REPOSITORY that can be cloned and run. You can fork electron-quick-start (https://github.com/electron/electron-quick-start) and include a link to the branch with your changes.
-->

> **Note: this reproduce description is outdated. Please check the update below**

You simply need to hide a window then show it again using remote.

#### Repo
```sh
$ git clone https://github.com/aabuhijleh/electron-quick-start
$ cd electron-quick-start
$ npm install
$ npm start
```

#### In the main process
```js
// hide window on minimize
mainWindow.on('minimize', event => {
  event.preventDefault()
  mainWindow.hide()
})
```

#### In the preload script
```js
// get window using remote
const {remote} = require('electron')
const {Tray} = remote
const mainWindow = remote.getCurrentWindow()

// show window using remote on tray icon click
let tray
window.onload = () => {
  tray = new Tray('tray.png')
  tray.on('click', () => {
    mainWindow.show()
  })
}
```

### Screen Recording
<!-- If applicable, add screenshots to help explain your problem. -->
![crash](https://user-images.githubusercontent.com/42934634/71415754-f740e880-2665-11ea-8399-56d332fc5058.gif)


### Additional Issue
An Electron process remains alive after the crash occurs and it never dies unless it's killed manually. This is also a very serious issue.


# UPDATE

This crash has nothing to do with the `remote` module.

It's related to showing/restoring a window after it has been minimized and hidden.

#### You only need to have something like this in the main process code
```js
// a crash occurs if window is shown after it's minimized & hidden
mainWindow.on("minimize", () => {
  mainWindow.hide()
  setTimeout(() => {
    mainWindow.show()
  }, 2000)
})
```

or simply
```js
mainWindow.minimize()
mainWindow.hide()
mainWindow.show() // or mainWindow.restore()
```
I believe a lot of Windows apps hide their windows to the system tray on `minimize` / `close` events. So this crash will also affect them as well. That's why I think this issue is critical.
shell/browser/native_window_views.h
void SetFullScreen(bool fullscreen) override;
  bool IsFullscreen() const override;
  void SetBounds(const gfx::Rect& bounds, bool animate) override;
  gfx::Rect GetBounds() override;
  gfx::Rect GetContentBounds() override;
  gfx::Size GetContentSize() override;
  gfx::Rect GetNormalBounds() override;
  SkColor GetBackgroundColor() override;
  void SetContentSizeConstraints(
      const extensions::SizeConstraints& size_constraints) override;
  void SetResizable(bool resizable) override;
  bool MoveAbove(const std::string& sourceId) override;
  void MoveTop() override;
  bool IsResizable() override;
  void SetAspectRatio(double aspect_ratio,
                      const gfx::Size& extra_size) override;
  void SetMovable(bool movable) override;
  bool IsMovable() override;
  void SetMinimizable(bool minimizable) override;
  bool IsMinimizable() override;
  void SetMaximizable(bool maximizable) override;
  bool IsMaximizable() override;
  void SetFullScreenable(bool fullscreenable) override;
  bool IsFullScreenable() override;
  void SetClosable(bool closable) override;
  bool IsClosable() override;
  void SetAlwaysOnTop(ui::ZOrderLevel z_order,
                      const std::string& level,
                      int relativeLevel) override;
  ui::ZOrderLevel GetZOrderLevel() override;