Fix [#36830] 'Reset to Default Value' on Current Area Type button causes crash

Default default value for space types (0, i.e. SPACE_EMPTY) is not valid, use SPACE_VIEW3D instead.
This commit is contained in:
Bastien Montagne
2013-09-29 13:25:42 +00:00
parent 3407a2e145
commit 4829cf9cd0
3 changed files with 2 additions and 2 deletions

View File

@@ -112,7 +112,7 @@ ARegionType *BKE_regiontype_from_id(SpaceType *st, int regionid)
if (art->regionid == regionid)
return art;
printf("Error, region type missing in - name:\"%s\", id:%d\n", st->name, st->spaceid);
printf("Error, region type %d missing in - name:\"%s\", id:%d\n", regionid, st->name, st->spaceid);
return st->regiontypes.first;
}

View File

@@ -1446,7 +1446,6 @@ void ED_area_newspace(bContext *C, ScrArea *sa, int type)
}
if (sl) {
/* swap regions */
slold->regionbase = sa->regionbase;
sa->regionbase = sl->regionbase;

View File

@@ -213,6 +213,7 @@ static void rna_def_area(BlenderRNA *brna)
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "spacetype");
RNA_def_property_enum_items(prop, space_type_items);
RNA_def_property_enum_default(prop, SPACE_VIEW3D);
RNA_def_property_enum_funcs(prop, NULL, "rna_Area_type_set", "rna_Area_type_itemf");
RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);