[OpenLayers-Dev] TransformFeature control destroy function seems to
have a bug
Fabian Patzke (OL)
listensammler at patzi.de
Mon Sep 20 10:07:58 EDT 2010
Hi, it seems that the TransformFeature control has a broken destroy function
or maybe its just me doing something forbidden. When you try to destroy the
control there can be an error in line 565. For me it happens when I do the
following.
- start the map
- start using the TransformFeature control
- deactivate the control and delete everything in the used vector layer (I
do this because I want a clear map after I used any kind of digi control)
- using TransformFeature.destroy() now throws an error, because there is no
geometry in the box left.
shouldn't there be a kind of check if the box has no geometry?
If someone else thinks that is a bug and not me using it the wrong way, I
would create a ticket.
Greetings,
Fabian
I made this patch and it works for me:
Index: lib/OpenLayers/Control/TransformFeature.js
===================================================================
--- lib/OpenLayers/Control/TransformFeature.js (revision 10773)
+++ lib/OpenLayers/Control/TransformFeature.js (working copy)
@@ -561,12 +561,14 @@
*/
destroy: function() {
var geom;
- for(var i=0; i<8; ++i) {
- geom = this.box.geometry.components[i];
- geom._handle.destroy();
- geom._handle = null;
- geom._rotationHandle && geom._rotationHandle.destroy();
- geom._rotationHandle = null;
+ if (this.box.geometry != null) {
+ for(var i=0; i<8; ++i) {
+ geom = this.box.geometry.components[i];
+ geom._handle.destroy();
+ geom._handle = null;
+ geom._rotationHandle && geom._rotationHandle.destroy();
+ geom._rotationHandle = null;
+ }
}
this.box.destroy();
this.box = null;
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/TransformFeature-control-destroy-function-seems-to-have-a-bug-tp5550628p5550628.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.
More information about the Dev
mailing list