Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include processor from pixelworks and terminate workers before creating new ones #11047

Merged
merged 1 commit into from May 17, 2020

Conversation

tschaub
Copy link
Member

@tschaub tschaub commented May 17, 2020

This pulls in the pixelworks dependency (which was really only depended on by this package) and terminates workers before creating new ones or when disposing of the source.

Fixes #8375.
Fixes #10856.

@tschaub tschaub merged commit 84b335f into openlayers:master May 17, 2020
@tschaub tschaub deleted the raster branch May 17, 2020 11:16
@werrolf
Copy link

werrolf commented Jun 15, 2020

This transfers the pixelworks assumption that a document.createElement is avaliable at import time, which is a problem for build and packaging tools.

May I suggest lazy instantiation of the canvas context, to allow canvas fallbacks to work in a browser context without breaking repackaging tools?

   hasImageData = false;
 }
 
-const context = document.createElement('canvas').getContext('2d');
+let context = null;
 
 function newImageData(data, width, height) {
   if (hasImageData) {
     return new ImageData(data, width, height);
   } else {
+    context = context || document.createElement('canvas').getContext('2d');
     var imageData = context.createImageData(width, height);
     imageData.data.set(data);
     return imageData;

See also tschaub/pixelworks#83

@tschaub
Copy link
Member Author

tschaub commented Jun 15, 2020

@werrolf - Thanks for the report. Would you mind creating a new issue with this information?

@werrolf
Copy link

werrolf commented Jun 19, 2020

Try as I might, I can no longer reproduce my original problem repackaging even the original pixelworks code. I suspect a nodejs update from 8 to 10 collateral to a recent Ubuntu upgrade may have increased import lenience. With no clear steps to reproduce, I don't know how to make a good issue out of this. Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raster webworkers not getting terminated (bug) Raster source cause webworkers threads memory leak
3 participants