Skip to content

Commit

Permalink
Ensure loseContext exists before calling it (#4245)
Browse files Browse the repository at this point in the history
* Fix - call loseContext only if exists

* optional chaining

* Update changelog - PR 4245 bug fix

* Update CHANGELOG.md

Co-authored-by: Harel M <harel.mazor@gmail.com>

---------

Co-authored-by: Birk Skyum <74932975+birkskyum@users.noreply.github.com>
Co-authored-by: Harel M <harel.mazor@gmail.com>
  • Loading branch information
3 people committed Jun 7, 2024
1 parent 760f9d1 commit b9bc927
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

- ⚠️ Allow breaking lines in labels before a left parenthesis ([#4138](https://github.com/maplibre/maplibre-gl-js/pull/4138))
- ⚠️ Fix ignoring embedded line breaks when `symbol-placement` is `line` or `line-center` ([#4124](https://github.com/maplibre/maplibre-gl-js/pull/4124))
- Ensure loseContext exists before calling it ([#4245](https://github.com/maplibre/maplibre-gl-js/pull/4245))
- _...Add new stuff here..._

## 4.3.2
Expand Down
2 changes: 1 addition & 1 deletion src/ui/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3154,7 +3154,7 @@ export class Map extends Camera {

this._resizeObserver?.disconnect();
const extension = this.painter.context.gl.getExtension('WEBGL_lose_context');
if (extension) extension.loseContext();
if (extension?.loseContext) extension.loseContext();
this._canvas.removeEventListener('webglcontextrestored', this._contextRestored, false);
this._canvas.removeEventListener('webglcontextlost', this._contextLost, false);
DOM.remove(this._canvasContainer);
Expand Down

0 comments on commit b9bc927

Please sign in to comment.