[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [22503] branches/blender2.5/blender/source /blender: - added RNA_struct_free_extension rather then having the funcs in each unregister func .
Campbell Barton
ideasman42 at gmail.com
Sun Aug 16 09:26:29 CEST 2009
Revision: 22503
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22503
Author: campbellbarton
Date: 2009-08-16 09:26:29 +0200 (Sun, 16 Aug 2009)
Log Message:
-----------
- added RNA_struct_free_extension rather then having the funcs in each unregister func.
- use RNA_struct_blender_type_set to set the type to NULL before its freed
There is a memory error here when reloading scripts - ui_handler_panel_region, need to look into theis further.
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c
branches/blender2.5/blender/source/blender/makesrna/RNA_define.h
branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_render.c
branches/blender2.5/blender/source/blender/makesrna/intern/rna_ui.c
Modified: branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c 2009-08-16 06:10:31 UTC (rev 22502)
+++ branches/blender2.5/blender/source/blender/editors/interface/interface_panel.c 2009-08-16 07:26:29 UTC (rev 22503)
@@ -1247,7 +1247,7 @@
if(!pa || pa->paneltab!=NULL)
continue;
- if(pa->type && pa->type->flag & PNL_NO_HEADER)
+ if(pa->type && pa->type->flag & PNL_NO_HEADER) // XXX - accessed freed panels when scripts reload, need to fix.
continue;
if(block->minx <= mx && block->maxx >= mx)
Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_define.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/RNA_define.h 2009-08-16 06:10:31 UTC (rev 22502)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_define.h 2009-08-16 07:26:29 UTC (rev 22503)
@@ -63,6 +63,7 @@
void RNA_def_struct_identifier(StructRNA *srna, const char *identifier);
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description);
void RNA_def_struct_ui_icon(StructRNA *srna, int icon);
+void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext);
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna);
/* Compact Property Definitions */
Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c 2009-08-16 06:10:31 UTC (rev 22502)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_define.c 2009-08-16 07:26:29 UTC (rev 22503)
@@ -458,6 +458,15 @@
DefRNA.verify= verify;
}
+void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext)
+{
+#ifdef RNA_RUNTIME
+ ext->free(ext->data); /* decref's the PyObject that the srna owns */
+ RNA_struct_blender_type_set(srna, NULL); /* this gets accessed again - XXX fixme */
+ RNA_struct_py_type_set(srna, NULL); /* NULL the srna's value so RNA_struct_free wont complain of a leak */
+#endif
+}
+
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
{
#ifdef RNA_RUNTIME
Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_render.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_render.c 2009-08-16 06:10:31 UTC (rev 22502)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_render.c 2009-08-16 07:26:29 UTC (rev 22503)
@@ -106,9 +106,7 @@
if(!et)
return;
- et->ext.free(et->ext.data); /* decref's the PyObject that the srna owns */
- RNA_struct_py_type_set(type, NULL); /* NULL the srna's value so RNA_struct_free wont complain of a leak */
-
+ RNA_struct_free_extension(type, &et->ext);
BLI_freelinkN(&R_engines, et);
RNA_struct_free(&BLENDER_RNA, type);
}
Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_ui.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/rna_ui.c 2009-08-16 06:10:31 UTC (rev 22502)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/rna_ui.c 2009-08-16 07:26:29 UTC (rev 22503)
@@ -138,8 +138,7 @@
if(!(art=region_type_find(NULL, pt->space_type, pt->region_type)))
return;
- pt->ext.free(pt->ext.data); /* decref's the PyObject that the srna owns */
- RNA_struct_py_type_set(type, NULL); /* NULL the srna's value so RNA_struct_free wont complain of a leak */
+ RNA_struct_free_extension(type, &pt->ext);
BLI_freelinkN(&art->paneltypes, pt);
RNA_struct_free(&BLENDER_RNA, type);
@@ -236,8 +235,7 @@
if(!(art=region_type_find(NULL, ht->space_type, RGN_TYPE_HEADER)))
return;
- ht->ext.free(ht->ext.data); /* decref's the PyObject that the srna owns */
- RNA_struct_py_type_set(type, NULL); /* NULL the srna's value so RNA_struct_free wont complain of a leak */
+ RNA_struct_free_extension(type, &ht->ext);
BLI_freelinkN(&art->headertypes, ht);
RNA_struct_free(&BLENDER_RNA, type);
@@ -353,8 +351,7 @@
if(!(art=region_type_find(NULL, mt->space_type, RGN_TYPE_HEADER)))
return;
- mt->ext.free(mt->ext.data); /* decref's the PyObject that the srna owns */
- RNA_struct_py_type_set(type, NULL); /* NULL the srna's value so RNA_struct_free wont complain of a leak */
+ RNA_struct_free_extension(type, &mt->ext);
BLI_freelinkN(&art->menutypes, mt);
RNA_struct_free(&BLENDER_RNA, type);
More information about the Bf-blender-cvs
mailing list