## Environment
Joplin version: 2.10.2
Platform: Windows 10
## Steps to re…produce
1. Double click any pdf to open it in the built in pdf viewer
2. Close the pdf via the X in the top right corner
## Describe what happened
The pdf should be closed normally. Instead Joplin crashes fatally. All plugins are disabled.
This post describes the same problem on macOS: https://discourse.joplinapp.org/t/pdfviewer-crashes-on-exit-click-the-x/28775
## Error message
```
Error
Joplin encountered a fatal error and could not continue.
To report the error, please copy the *entire content* of this page and post it on Joplin forum or GitHub.
If the error persists you may try to [restart in safe mode](https://github.com/laurent22/joplin/issues/new?assignees=&labels=bug&template=bug_report.md&title=#), which will temporarily disable all plugins.
Message
Cannot read properties of null (reading 'removeEventListener')
Version info
Joplin for Desktop
Copyright © 2016-2022 Laurent Cozic
Joplin 2.10.2 (prod, win32)
Client ID: 1a9cc84bc84042558ce8b84c8eafa947
Sync Version: 3
Profile Version: 41
Keychain Supported: Yes
Revision: 0a65d53
Plugins
[
{
"id": "io.github.jackgruber.backup",
"name": "Simple Backup",
"enabled": false,
"version": "1.2.1"
},
{
"id": "joplin.plugin.spoiler.cards",
"name": "Spoilers",
"enabled": false,
"version": "1.0.6"
},
{
"id": "joplin.plugin.note.tabs",
"name": "Note Tabs",
"enabled": false,
"version": "1.4.0"
},
{
"id": "io.github.jackgruber.hotfolder",
"name": "Hotfolder",
"enabled": false,
"version": "1.0.1"
},
{
"id": "com.andrejilderda.macOSTheme",
"name": "macOS theme",
"enabled": false,
"version": "1.3.9"
},
{
"id": "joplin.plugin.alondmnt.history-panel",
"name": "History Panel",
"enabled": false,
"version": "1.0.1"
},
{
"id": "ylc395.joplinOcr",
"name": "OCR",
"enabled": false,
"version": "0.3.2"
},
{
"id": "joplin-plugin-dddot",
"name": "Joplin DDDot",
"enabled": false,
"version": "0.2.0"
},
{
"id": "io.github.personalizedrefrigerator.js-draw",
"name": "Freehand Drawing",
"enabled": false,
"version": "1.3.5"
},
{
"id": "com.septemberhx.Joplin.Enhancement",
"name": "Enhancement",
"enabled": false,
"version": "1.1.2"
},
{
"id": "kensam.joplin.plugin.eztable",
"name": "Ez Table",
"enabled": false,
"version": "1.0.2"
}
]
Stack trace
TypeError: Cannot read properties of null (reading 'removeEventListener')
at C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\gui\PdfViewer.js:84:34
at safelyCallDestroy (C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:22932:5)
at commitHookEffectListUnmount (C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:23100:11)
at commitPassiveUnmountInsideDeletedTreeOnFiber (C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:25098:11)
at commitPassiveUnmountEffectsInsideOfDeletedTree_begin (C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:25048:5)
at commitPassiveUnmountEffects_begin (C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:24956:11)
at commitPassiveUnmountEffects (C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:24941:3)
at flushPassiveEffectsImpl (C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:27038:3)
at flushPassiveEffects (C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:26984:14)
at commitRootImpl (C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\node_modules\react-dom\cjs\react-dom.development.js:26935:5)
Component stack
at PdfViewer (C:\Users\Robin\AppData\Local\Programs\Joplin\resources\app.asar\gui\PdfViewer.js:37:42)
```