[Kde-bindings] KDE/kdebindings/csharp/qyoto/src
Arno Rehn
kde at arnorehn.de
Mon Apr 16 17:53:36 UTC 2007
SVN commit 654648 by arnorehn:
* Fixed some more memory leaks in the marshallers
CCMAIL: kde-bindings at kde.org
M +29 -5 handlers.cpp
--- trunk/KDE/kdebindings/csharp/qyoto/src/handlers.cpp #654647:654648
@@ -1025,6 +1025,7 @@
{
if (m->var().s_class == 0) {
m->item().s_class = 0;
+ (*FreeGCHandle)(m->var().s_class);
return;
}
@@ -1037,6 +1038,7 @@
break;
}
m->item().s_class = o->ptr;
+ (*FreeGCHandle)(m->var().s_class);
break;
}
@@ -1086,6 +1088,7 @@
if (m->cleanup()) {
delete map;
}
+ (*FreeGCHandle)(m->var().s_voidp);
break;
}
@@ -1101,6 +1104,7 @@
smokeqyoto_object * vo = alloc_smokeqyoto_object(false, m->smoke(), id, v);
void* value = (*CreateInstance)("Qyoto.QVariant", vo);
(*AddIntObjectToDictionary)(dict, i.key(), value);
+ (*FreeGCHandle)(value);
}
m->var().s_voidp = dict;
@@ -1126,6 +1130,7 @@
if (m->cleanup()) {
delete map;
}
+ (*FreeGCHandle)(m->var().s_voidp);
break;
}
@@ -1135,9 +1140,13 @@
void* dict = (*ConstructDictionary)("System.String", "System.String");
for (QMap<QString, QString>::iterator i = map->begin(); i != map->end(); ++i) {
+ void* string1 = (void*) StringFromQString((void*) &(i.key()));
+ void* string2 = (void*) StringFromQString((void*) &(i.value()));
(*AddObjectObjectToDictionary)( dict,
- (void*) StringFromQString((void*) &(i.key())),
- (void*) StringFromQString((void*) &(i.value())));
+ string1,
+ string2);
+ (*FreeGCHandle)(string1);
+ (*FreeGCHandle)(string2);
}
m->var().s_voidp = dict;
@@ -1163,6 +1172,7 @@
if (m->cleanup()) {
delete map;
}
+ (*FreeGCHandle)(m->var().s_voidp);
break;
}
@@ -1177,9 +1187,12 @@
void* v = (void*) &(i.value());
smokeqyoto_object * vo = alloc_smokeqyoto_object(false, m->smoke(), id, v);
void* value = (*CreateInstance)("Qyoto.QVariant", vo);
+ void* string = (void*) StringFromQString((void*) &(i.key()));
(*AddObjectObjectToDictionary)( dict,
- (void*) StringFromQString((void*) &(i.key())),
+ string,
value);
+ (*FreeGCHandle)(string);
+ (*FreeGCHandle)(value);
}
m->var().s_voidp = dict;
@@ -1232,6 +1245,7 @@
if (m->cleanup()) {
delete stringlist;
}
+ (*FreeGCHandle)(m->var().s_voidp);
break;
}
@@ -1279,7 +1293,8 @@
QList<void*>* list = (QList<void*>*) (*ListToPointerList)(m->var().s_voidp);
for (int i = 0; i < list->size(); ++i) {
- smokeqyoto_object * o = (smokeqyoto_object*) (*GetSmokeObject)(list->at(i));
+ void* obj = list->at(i);
+ smokeqyoto_object * o = (smokeqyoto_object*) (*GetSmokeObject)(obj);
void* ptr = o->ptr;
ptr = o->smoke->cast(
@@ -1289,11 +1304,15 @@
);
cpplist->append((Item*) ptr);
+ (*FreeGCHandle)(obj);
}
m->item().s_voidp = cpplist;
m->next();
+ delete list;
+ (*FreeGCHandle)(m->var().s_voidp);
+
if (m->cleanup()) {
delete cpplist;
}
@@ -1348,6 +1367,8 @@
m->item().s_voidp = valuelist;
m->next();
+ (*FreeGCHandle)(m->var().s_voidp);
+
/*if (m->cleanup()) {
delete valuelist;
}*/
@@ -1414,7 +1435,8 @@
QList<void*>* list = (QList<void*>*) (*ListToPointerList)(m->var().s_voidp);
for (int i = 0; i < list->size(); ++i) {
- smokeqyoto_object * o = (smokeqyoto_object*) (*GetSmokeObject)(list->at(i));
+ void* obj = list->at(i);
+ smokeqyoto_object * o = (smokeqyoto_object*) (*GetSmokeObject)(obj);
void* ptr = o->ptr;
ptr = o->smoke->cast(
@@ -1424,12 +1446,14 @@
);
cpplist->append(*(Item*) ptr);
+ (*FreeGCHandle)(obj);
}
m->item().s_voidp = cpplist;
m->next();
delete list;
+ (*FreeGCHandle)(m->var().s_voidp);
if (m->cleanup()) {
delete cpplist;
More information about the Kde-bindings
mailing list