-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Don't unlisten image twice when disposing an ol.ImageTile #3360
Conversation
Your change implies that |
If the |
I have the same patch in one of branches. I think it is correct. We dispose of tiles in |
I still think that the underlying issue is somewhere else. So if you want to merge this, please add a BIG FAT TODO reminding us to investigate this properly. |
I don't get it Andreas. |
The problem is that we may call |
If the above reasoning is true, then the following - more straightforward - version of ol.ImageTile.prototype.disposeInternal = function() {
if (this.state == ol.TileState.LOADING || this.state == ol.TileState.ERROR) {
this.unlistenImage_();
}
goog.base(this, 'disposeInternal');
}; Am I right? |
Not quite, because ol.ImageTile.prototype.disposeInternal = function() {
if (this.state == ol.TileState.LOADING) {
this.unlistenImage_();
}
goog.base(this, 'disposeInternal');
}; |
👍, the above would make me happy. |
Eric's proposal is more explicit, will change |
d0e0d99
to
f474e7c
Compare
Another option would be to change the Instead of /**
* Discards event handlers which listen for load completion or errors.
*
* @private
*/
ol.ImageTile.prototype.unlistenImage_ = function() {
goog.asserts.assert(!goog.isNull(this.imageListenerKeys_));
goog.array.forEach(this.imageListenerKeys_, goog.events.unlistenByKey);
this.imageListenerKeys_ = null;
}; it would be: /**
* Discards event handlers which listen for load completion or errors.
*
* @private
*/
ol.ImageTile.prototype.unlistenImage_ = function() {
if (!goog.isNull(this.imageListenerKeys_)) {
goog.array.forEach(this.imageListenerKeys_, goog.events.unlistenByKey);
this.imageListenerKeys_ = null;
}
}; |
The previous proposal was more explicit. I always like to know the exact state from reading the code. Just checking whether there are still listeners registered does not look like an exact state to me. |
I see what you mean! |
Thanks for the review |
Don't unlisten image twice when disposing an ol.ImageTile
Fixes #3325