From 332c93f76709b2398264fb5fde6dc33a951f27a5 Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Fri, 26 Aug 2016 18:41:40 -0400 Subject: [PATCH] ecere/com/containers; sys/File: Fixed refCount of deserialized containers, Files --- compiler/bootstrap/ecere/bootstrap/Array.c | 1 + compiler/bootstrap/ecere/bootstrap/Container.c | 1 + compiler/bootstrap/ecere/bootstrap/Map.c | 1 + ecere/src/com/containers/Array.ec | 1 + ecere/src/com/containers/Container.ec | 1 + ecere/src/com/containers/Map.ec | 1 + ecere/src/sys/File.ec | 1 + 7 files changed, 7 insertions(+) diff --git a/compiler/bootstrap/ecere/bootstrap/Array.c b/compiler/bootstrap/ecere/bootstrap/Array.c index 78dc061..2cb2df1 100644 --- a/compiler/bootstrap/ecere/bootstrap/Array.c +++ b/compiler/bootstrap/ecere/bootstrap/Array.c @@ -597,6 +597,7 @@ struct __ecereNameSpace__ecere__com__Instance * array = __ecereNameSpace__ecere_ unsigned int count, c; struct __ecereNameSpace__ecere__com__Class * Dclass = class->templateArgs[2].__anon1.__anon1.dataTypeClass; +array->_refCount++; __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Get(channel, __ecereClass_uint, (void *)&count); __ecereProp___ecereNameSpace__ecere__com__Array_Set_size(array, count); for(c = 0; c < count; c++) diff --git a/compiler/bootstrap/ecere/bootstrap/Container.c b/compiler/bootstrap/ecere/bootstrap/Container.c index c2d5604..dd9653c 100644 --- a/compiler/bootstrap/ecere/bootstrap/Container.c +++ b/compiler/bootstrap/ecere/bootstrap/Container.c @@ -1312,6 +1312,7 @@ struct __ecereNameSpace__ecere__com__Class * Dclass = class->templateArgs[2].__a uint64 data; unsigned int isStruct = Dclass->type == 1; +container->_refCount++; __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Get(channel, __ecereClass_uint, (void *)&count); if(isStruct) data = (uint64)(uintptr_t)(__ecereNameSpace__ecere__com__eSystem_New(sizeof(unsigned char) * (Dclass->structSize))); diff --git a/compiler/bootstrap/ecere/bootstrap/Map.c b/compiler/bootstrap/ecere/bootstrap/Map.c index 12d2626..d6fcc24 100644 --- a/compiler/bootstrap/ecere/bootstrap/Map.c +++ b/compiler/bootstrap/ecere/bootstrap/Map.c @@ -972,6 +972,7 @@ struct __ecereNameSpace__ecere__com__Instance * container = __ecereNameSpace__ec struct __ecereNameSpace__ecere__com__Class * Kclass = class->templateArgs[5].__anon1.__anon1.dataTypeClass; struct __ecereNameSpace__ecere__com__Class * Dclass = class->templateArgs[6].__anon1.__anon1.dataTypeClass; +container->_refCount++; __ecereMethod___ecereNameSpace__ecere__com__IOChannel_Get(channel, __ecereClass_uint, (void *)&count); for(c = 0; c < count; c++) { diff --git a/ecere/src/com/containers/Array.ec b/ecere/src/com/containers/Array.ec index b27c325..00bdbd1 100644 --- a/ecere/src/com/containers/Array.ec +++ b/ecere/src/com/containers/Array.ec @@ -170,6 +170,7 @@ public: Array array = eInstance_New(_class); //.fullName); uint count, c; Class Dclass = class(D); + incref array; channel.Get(count); #ifdef _DEBUG //printf("%d %ss\n", count, Dclass.name); diff --git a/ecere/src/com/containers/Container.ec b/ecere/src/com/containers/Container.ec index 808251e..6f1b0db 100644 --- a/ecere/src/com/containers/Container.ec +++ b/ecere/src/com/containers/Container.ec @@ -314,6 +314,7 @@ public: Class Dclass = class(D); D data; bool isStruct = Dclass.type == structClass; + incref container; channel.Get(count); if(isStruct) diff --git a/ecere/src/com/containers/Map.ec b/ecere/src/com/containers/Map.ec index 57c6400..9aecc93 100644 --- a/ecere/src/com/containers/Map.ec +++ b/ecere/src/com/containers/Map.ec @@ -319,6 +319,7 @@ public class Map : CustomAVLTree, I = MT, D = thisclass container = eInstance_New(_class.fullName); Class Kclass = class(MT); Class Dclass = class(V); + incref container; channel.Get(count); for(c = 0; c < count; c++) diff --git a/ecere/src/sys/File.ec b/ecere/src/sys/File.ec index 34da1f7..f0421c0 100644 --- a/ecere/src/sys/File.ec +++ b/ecere/src/sys/File.ec @@ -423,6 +423,7 @@ public class File : IOChannel if(uncompressed || !size) { this = TempFile { }; + incref this; uncompress(uncompressed, &size, compressed, cSize); Write(uncompressed, 1, (uint)size); Seek(0, start); -- 1.8.3.1