Commit 3ce644f2 authored by Roman Sedaikin's avatar Roman Sedaikin

Fixed disposing and removing layers.

parent 96d7ce0d
...@@ -113,11 +113,6 @@ extern "C" ...@@ -113,11 +113,6 @@ extern "C"
LayerHandler *layer = findByObject(env, canvas); LayerHandler *layer = findByObject(env, canvas);
if (layer != NULL) if (layer != NULL)
{ {
if (layer->context == NULL)
{
layerStorage->erase(layer);
delete layer;
}
return; return;
} }
} }
...@@ -188,7 +183,9 @@ extern "C" ...@@ -188,7 +183,9 @@ extern "C"
LayerHandler *layer = findByObject(env, canvas); LayerHandler *layer = findByObject(env, canvas);
if (layer != NULL) if (layer != NULL)
{ {
layerStorage->erase(layer);
layer->disposeLayer(env); layer->disposeLayer(env);
delete layer;
} }
} }
......
...@@ -84,11 +84,6 @@ extern "C" ...@@ -84,11 +84,6 @@ extern "C"
LayerHandler *layer = findByObject(env, canvas); LayerHandler *layer = findByObject(env, canvas);
if (layer != NULL) if (layer != NULL)
{ {
if (layer->context == NULL)
{
layerStorage->erase(layer);
delete layer;
}
return; return;
} }
} }
...@@ -172,7 +167,9 @@ extern "C" ...@@ -172,7 +167,9 @@ extern "C"
LayerHandler *layer = findByObject(env, canvas); LayerHandler *layer = findByObject(env, canvas);
if (layer != NULL) if (layer != NULL)
{ {
layerStorage->erase(layer);
layer->disposeLayer(env); layer->disposeLayer(env);
delete layer;
} }
} }
......
...@@ -177,6 +177,7 @@ JavaVM *jvm = NULL; ...@@ -177,6 +177,7 @@ JavaVM *jvm = NULL;
- (void) disposeLayer:(JNIEnv *) env - (void) disposeLayer:(JNIEnv *) env
{ {
[self.glLayer removeFromSuperlayer];
(*env)->DeleteGlobalRef(env, self.glLayer.canvasGlobalRef); (*env)->DeleteGlobalRef(env, self.glLayer.canvasGlobalRef);
self.glLayer.canvasGlobalRef = NULL; self.glLayer.canvasGlobalRef = NULL;
self.glLayer = NULL; self.glLayer = NULL;
...@@ -218,12 +219,6 @@ JNIEXPORT void JNICALL Java_org_jetbrains_skiko_HardwareLayer_updateLayer(JNIEnv ...@@ -218,12 +219,6 @@ JNIEXPORT void JNICALL Java_org_jetbrains_skiko_HardwareLayer_updateLayer(JNIEnv
LayerHandler *layer = findByObject(env, canvas); LayerHandler *layer = findByObject(env, canvas);
if (layer != NULL) if (layer != NULL)
{ {
if (layer.container == NULL && layer.glLayer == NULL)
{
[layerStorage removeObject: layer];
unlockLayers();
return;
}
[layer syncLayersSize]; [layer syncLayersSize];
unlockLayers(); unlockLayers();
return; return;
...@@ -306,6 +301,7 @@ JNIEXPORT void JNICALL Java_org_jetbrains_skiko_HardwareLayer_disposeLayer(JNIEn ...@@ -306,6 +301,7 @@ JNIEXPORT void JNICALL Java_org_jetbrains_skiko_HardwareLayer_disposeLayer(JNIEn
unlockLayers(); unlockLayers();
if (layer != NULL) if (layer != NULL)
{ {
[layerStorage removeObject: layer];
[layer disposeLayer: env]; [layer disposeLayer: env];
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment