We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Segfault when exiting Command Line Usage Example
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
When Running the command line example, and closing the window, I get a segmentation fault

### Code to reproduce
<!-- Please provide a minimal working example that reproduces the issue in the code block below.
     Ideally, this should be a full example someone else could run without additional setup. -->
```bash
python -m pyqtgraph.examples
```

Run the command line usage example, and close out the window.


### Expected behavior
Window closes

### Real behavior
Window closes, generates a segfault

```
/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py:125: RuntimeWarning: 'pyqtgraph.examples.__main__' found in sys.modules after import of package 'pyqtgraph.examples', but prior to execution of 'pyqtgraph.examples.__main__'; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
qt.qpa.fonts: Populating font family aliases took 246 ms. Replace uses of missing font family "FreeMono" with one that exists to avoid this cost.
Using PyQt5 (default graphics system)
Fatal Python error: Segmentation fault

Current thread 0x000000010840bdc0 (most recent call first):
  File "/Users/ognyan/Developer/pyqtgraph/.venv/lib/python3.7/site-packages/pyqtgraph/examples/CLIexample.py", line 26 in <module>
```

### Tested environment(s)

 * PyQtGraph version: 0.11
 * Qt Python binding: PySide2 5.15.0 and PyQt5 5.15.0
 * Python version: 3.7.7
 * NumPy version: 1.18.4
 * Operating system: macOS Catalina
 * Installation method: pip

### Additional context

This is not an issue with 0.11.rc0

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pyqtgraph/graphicsWindows.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 """
3 DEPRECATED:  The classes below are convenience classes that create a new window
4 containting a single, specific widget. These classes are now unnecessary because
5 it is possible to place any widget into its own window by simply calling its
6 show() method.
7 """
8 
9 from .Qt import QtCore, QtGui, mkQApp
10 from .widgets.PlotWidget import *
11 from .imageview import *
12 from .widgets.GraphicsLayoutWidget import GraphicsLayoutWidget
13 from .widgets.GraphicsView import GraphicsView
14 
15 
16 class GraphicsWindow(GraphicsLayoutWidget):
17     """
18     (deprecated; use :class:`~pyqtgraph.GraphicsLayoutWidget` instead)
19     
20     Convenience subclass of :class:`~pyqtgraph.GraphicsLayoutWidget`. This class
21     is intended for use from the interactive python prompt.
22     """
23     def __init__(self, title=None, size=(800,600), **kargs):
24         mkQApp()
25         GraphicsLayoutWidget.__init__(self, **kargs)
26         self.resize(*size)
27         if title is not None:
28             self.setWindowTitle(title)
29         self.show()
30         
31 
32 class TabWindow(QtGui.QMainWindow):
33     """
34     (deprecated)
35     """
36     def __init__(self, title=None, size=(800,600)):
37         mkQApp()
38         QtGui.QMainWindow.__init__(self)
39         self.resize(*size)
40         self.cw = QtGui.QTabWidget()
41         self.setCentralWidget(self.cw)
42         if title is not None:
43             self.setWindowTitle(title)
44         self.show()
45         
46     def __getattr__(self, attr):
47         return getattr(self.cw, attr)
48     
49 
50 class PlotWindow(PlotWidget):
51     sigClosed = QtCore.Signal(object)
52 
53     """
54     (deprecated; use :class:`~pyqtgraph.PlotWidget` instead)
55     """
56     def __init__(self, title=None, **kargs):
57         mkQApp()
58         PlotWidget.__init__(self, **kargs)
59         if title is not None:
60             self.setWindowTitle(title)
61         self.show()
62 
63     def closeEvent(self, event):
64         PlotWidget.closeEvent(self, event)
65         self.sigClosed.emit(self)
66 
67 
68 class ImageWindow(ImageView):
69     sigClosed = QtCore.Signal(object)
70 
71     """
72     (deprecated; use :class:`~pyqtgraph.ImageView` instead)
73     """
74     def __init__(self, *args, **kargs):
75         mkQApp()
76         ImageView.__init__(self)
77         if 'title' in kargs:
78             self.setWindowTitle(kargs['title'])
79             del kargs['title']
80         if len(args) > 0 or len(kargs) > 0:
81             self.setImage(*args, **kargs)
82         self.show()
83 
84     def closeEvent(self, event):
85         ImageView.closeEvent(self, event)
86         self.sigClosed.emit(self)
87
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/pyqtgraph/graphicsWindows.py b/pyqtgraph/graphicsWindows.py
--- a/pyqtgraph/graphicsWindows.py
+++ b/pyqtgraph/graphicsWindows.py
@@ -55,10 +55,14 @@
     """
     def __init__(self, title=None, **kargs):
         mkQApp()
+        self.win = QtGui.QMainWindow()
         PlotWidget.__init__(self, **kargs)
+        self.win.setCentralWidget(self)
+        for m in ['resize']:
+            setattr(self, m, getattr(self.win, m))
         if title is not None:
-            self.setWindowTitle(title)
-        self.show()
+            self.win.setWindowTitle(title)
+        self.win.show()
 
     def closeEvent(self, event):
         PlotWidget.closeEvent(self, event)
@@ -73,14 +77,20 @@
     """
     def __init__(self, *args, **kargs):
         mkQApp()
-        ImageView.__init__(self)
+        self.win = QtGui.QMainWindow()
+        self.win.resize(800,600)
         if 'title' in kargs:
-            self.setWindowTitle(kargs['title'])
+            self.win.setWindowTitle(kargs['title'])
             del kargs['title']
+        ImageView.__init__(self, self.win)
         if len(args) > 0 or len(kargs) > 0:
             self.setImage(*args, **kargs)
-        self.show()
-
+        
+        self.win.setCentralWidget(self)
+        for m in ['resize']:
+            setattr(self, m, getattr(self.win, m))
+        self.win.show()
+    
     def closeEvent(self, event):
         ImageView.closeEvent(self, event)
         self.sigClosed.emit(self)

{"golden_diff": "diff --git a/pyqtgraph/graphicsWindows.py b/pyqtgraph/graphicsWindows.py\n--- a/pyqtgraph/graphicsWindows.py\n+++ b/pyqtgraph/graphicsWindows.py\n@@ -55,10 +55,14 @@\n     \"\"\"\n     def __init__(self, title=None, **kargs):\n         mkQApp()\n+        self.win = QtGui.QMainWindow()\n         PlotWidget.__init__(self, **kargs)\n+        self.win.setCentralWidget(self)\n+        for m in ['resize']:\n+            setattr(self, m, getattr(self.win, m))\n         if title is not None:\n-            self.setWindowTitle(title)\n-        self.show()\n+            self.win.setWindowTitle(title)\n+        self.win.show()\n \n     def closeEvent(self, event):\n         PlotWidget.closeEvent(self, event)\n@@ -73,14 +77,20 @@\n     \"\"\"\n     def __init__(self, *args, **kargs):\n         mkQApp()\n-        ImageView.__init__(self)\n+        self.win = QtGui.QMainWindow()\n+        self.win.resize(800,600)\n         if 'title' in kargs:\n-            self.setWindowTitle(kargs['title'])\n+            self.win.setWindowTitle(kargs['title'])\n             del kargs['title']\n+        ImageView.__init__(self, self.win)\n         if len(args) > 0 or len(kargs) > 0:\n             self.setImage(*args, **kargs)\n-        self.show()\n-\n+        \n+        self.win.setCentralWidget(self)\n+        for m in ['resize']:\n+            setattr(self, m, getattr(self.win, m))\n+        self.win.show()\n+    \n     def closeEvent(self, event):\n         ImageView.closeEvent(self, event)\n         self.sigClosed.emit(self)\n", "issue": "Segfault when exiting Command Line Usage Example\n<!-- In the following, please describe your issue in detail! -->\r\n<!-- If some of the sections do not apply, just remove them. -->\r\n\r\n### Short description\r\nWhen Running the command line example, and closing the window, I get a segmentation fault\r\n\r\n### Code to reproduce\r\n<!-- Please provide a minimal working example that reproduces the issue in the code block below.\r\n     Ideally, this should be a full example someone else could run without additional setup. -->\r\n```bash\r\npython -m pyqtgraph.examples\r\n```\r\n\r\nRun the command line usage example, and close out the window.\r\n\r\n\r\n### Expected behavior\r\nWindow closes\r\n\r\n### Real behavior\r\nWindow closes, generates a segfault\r\n\r\n```\r\n/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py:125: RuntimeWarning: 'pyqtgraph.examples.__main__' found in sys.modules after import of package 'pyqtgraph.examples', but prior to execution of 'pyqtgraph.examples.__main__'; this may result in unpredictable behaviour\r\n  warn(RuntimeWarning(msg))\r\nqt.qpa.fonts: Populating font family aliases took 246 ms. Replace uses of missing font family \"FreeMono\" with one that exists to avoid this cost.\r\nUsing PyQt5 (default graphics system)\r\nFatal Python error: Segmentation fault\r\n\r\nCurrent thread 0x000000010840bdc0 (most recent call first):\r\n  File \"/Users/ognyan/Developer/pyqtgraph/.venv/lib/python3.7/site-packages/pyqtgraph/examples/CLIexample.py\", line 26 in <module>\r\n```\r\n\r\n### Tested environment(s)\r\n\r\n * PyQtGraph version: 0.11\r\n * Qt Python binding: PySide2 5.15.0 and PyQt5 5.15.0\r\n * Python version: 3.7.7\r\n * NumPy version: 1.18.4\r\n * Operating system: macOS Catalina\r\n * Installation method: pip\r\n\r\n### Additional context\r\n\r\nThis is not an issue with 0.11.rc0\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nDEPRECATED:  The classes below are convenience classes that create a new window\ncontainting a single, specific widget. These classes are now unnecessary because\nit is possible to place any widget into its own window by simply calling its\nshow() method.\n\"\"\"\n\nfrom .Qt import QtCore, QtGui, mkQApp\nfrom .widgets.PlotWidget import *\nfrom .imageview import *\nfrom .widgets.GraphicsLayoutWidget import GraphicsLayoutWidget\nfrom .widgets.GraphicsView import GraphicsView\n\n\nclass GraphicsWindow(GraphicsLayoutWidget):\n    \"\"\"\n    (deprecated; use :class:`~pyqtgraph.GraphicsLayoutWidget` instead)\n    \n    Convenience subclass of :class:`~pyqtgraph.GraphicsLayoutWidget`. This class\n    is intended for use from the interactive python prompt.\n    \"\"\"\n    def __init__(self, title=None, size=(800,600), **kargs):\n        mkQApp()\n        GraphicsLayoutWidget.__init__(self, **kargs)\n        self.resize(*size)\n        if title is not None:\n            self.setWindowTitle(title)\n        self.show()\n        \n\nclass TabWindow(QtGui.QMainWindow):\n    \"\"\"\n    (deprecated)\n    \"\"\"\n    def __init__(self, title=None, size=(800,600)):\n        mkQApp()\n        QtGui.QMainWindow.__init__(self)\n        self.resize(*size)\n        self.cw = QtGui.QTabWidget()\n        self.setCentralWidget(self.cw)\n        if title is not None:\n            self.setWindowTitle(title)\n        self.show()\n        \n    def __getattr__(self, attr):\n        return getattr(self.cw, attr)\n    \n\nclass PlotWindow(PlotWidget):\n    sigClosed = QtCore.Signal(object)\n\n    \"\"\"\n    (deprecated; use :class:`~pyqtgraph.PlotWidget` instead)\n    \"\"\"\n    def __init__(self, title=None, **kargs):\n        mkQApp()\n        PlotWidget.__init__(self, **kargs)\n        if title is not None:\n            self.setWindowTitle(title)\n        self.show()\n\n    def closeEvent(self, event):\n        PlotWidget.closeEvent(self, event)\n        self.sigClosed.emit(self)\n\n\nclass ImageWindow(ImageView):\n    sigClosed = QtCore.Signal(object)\n\n    \"\"\"\n    (deprecated; use :class:`~pyqtgraph.ImageView` instead)\n    \"\"\"\n    def __init__(self, *args, **kargs):\n        mkQApp()\n        ImageView.__init__(self)\n        if 'title' in kargs:\n            self.setWindowTitle(kargs['title'])\n            del kargs['title']\n        if len(args) > 0 or len(kargs) > 0:\n            self.setImage(*args, **kargs)\n        self.show()\n\n    def closeEvent(self, event):\n        ImageView.closeEvent(self, event)\n        self.sigClosed.emit(self)\n", "path": "pyqtgraph/graphicsWindows.py"}], "after_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"\nDEPRECATED:  The classes below are convenience classes that create a new window\ncontainting a single, specific widget. These classes are now unnecessary because\nit is possible to place any widget into its own window by simply calling its\nshow() method.\n\"\"\"\n\nfrom .Qt import QtCore, QtGui, mkQApp\nfrom .widgets.PlotWidget import *\nfrom .imageview import *\nfrom .widgets.GraphicsLayoutWidget import GraphicsLayoutWidget\nfrom .widgets.GraphicsView import GraphicsView\n\n\nclass GraphicsWindow(GraphicsLayoutWidget):\n    \"\"\"\n    (deprecated; use :class:`~pyqtgraph.GraphicsLayoutWidget` instead)\n    \n    Convenience subclass of :class:`~pyqtgraph.GraphicsLayoutWidget`. This class\n    is intended for use from the interactive python prompt.\n    \"\"\"\n    def __init__(self, title=None, size=(800,600), **kargs):\n        mkQApp()\n        GraphicsLayoutWidget.__init__(self, **kargs)\n        self.resize(*size)\n        if title is not None:\n            self.setWindowTitle(title)\n        self.show()\n        \n\nclass TabWindow(QtGui.QMainWindow):\n    \"\"\"\n    (deprecated)\n    \"\"\"\n    def __init__(self, title=None, size=(800,600)):\n        mkQApp()\n        QtGui.QMainWindow.__init__(self)\n        self.resize(*size)\n        self.cw = QtGui.QTabWidget()\n        self.setCentralWidget(self.cw)\n        if title is not None:\n            self.setWindowTitle(title)\n        self.show()\n        \n    def __getattr__(self, attr):\n        return getattr(self.cw, attr)\n    \n\nclass PlotWindow(PlotWidget):\n    sigClosed = QtCore.Signal(object)\n\n    \"\"\"\n    (deprecated; use :class:`~pyqtgraph.PlotWidget` instead)\n    \"\"\"\n    def __init__(self, title=None, **kargs):\n        mkQApp()\n        self.win = QtGui.QMainWindow()\n        PlotWidget.__init__(self, **kargs)\n        self.win.setCentralWidget(self)\n        for m in ['resize']:\n            setattr(self, m, getattr(self.win, m))\n        if title is not None:\n            self.win.setWindowTitle(title)\n        self.win.show()\n\n    def closeEvent(self, event):\n        PlotWidget.closeEvent(self, event)\n        self.sigClosed.emit(self)\n\n\nclass ImageWindow(ImageView):\n    sigClosed = QtCore.Signal(object)\n\n    \"\"\"\n    (deprecated; use :class:`~pyqtgraph.ImageView` instead)\n    \"\"\"\n    def __init__(self, *args, **kargs):\n        mkQApp()\n        self.win = QtGui.QMainWindow()\n        self.win.resize(800,600)\n        if 'title' in kargs:\n            self.win.setWindowTitle(kargs['title'])\n            del kargs['title']\n        ImageView.__init__(self, self.win)\n        if len(args) > 0 or len(kargs) > 0:\n            self.setImage(*args, **kargs)\n        \n        self.win.setCentralWidget(self)\n        for m in ['resize']:\n            setattr(self, m, getattr(self.win, m))\n        self.win.show()\n    \n    def closeEvent(self, event):\n        ImageView.closeEvent(self, event)\n        self.sigClosed.emit(self)\n", "path": "pyqtgraph/graphicsWindows.py"}]}