Fix T38515: python menu tooltip description affecting unrelated menus.

This commit is contained in:
Brecht Van Lommel 2014-02-06 16:14:58 +01:00
parent e8e32db3be
commit 10b82471f4
Notes: blender-bot 2023-02-14 11:14:29 +01:00
Referenced by issue #38515, Menu tooltip description taking over other menus
1 changed files with 3 additions and 3 deletions

View File

@ -677,7 +677,6 @@ static void rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type)
WM_main_add_notifier(NC_WINDOW, NULL);
}
static char _menu_descr[RNA_DYN_DESCR_MAX];
static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data, const char *identifier,
StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
@ -687,14 +686,13 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data
int have_function[2];
size_t over_alloc = 0; /* warning, if this becomes a bess, we better do another alloc */
size_t description_size = 0;
char _menu_descr[RNA_DYN_DESCR_MAX] = {0};
/* setup dummy menu & menu type to store static properties in */
dummymenu.type = &dummymt;
dummymenu.type->description = _menu_descr;
RNA_pointer_create(NULL, &RNA_Menu, &dummymenu, &dummymtr);
/* clear in case they are left unset */
_menu_descr[0] = '\0';
/* We have to set default context! Else we get a void string... */
strcpy(dummymt.translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA);
@ -727,6 +725,8 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data
memcpy(buf, _menu_descr, description_size);
mt->description = buf;
}
else
mt->description = "";
mt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, mt->idname, &RNA_Menu);
RNA_def_struct_translation_context(mt->ext.srna, mt->translation_context);