Safety protection in creation of extended GWIN types.

ugfx_release_2.6
inmarket 2015-01-03 18:42:51 +10:00
parent 476d11d599
commit da13b83737
1 changed files with 6 additions and 0 deletions

View File

@ -16,6 +16,8 @@
#include "gwin_class.h"
#include <string.h>
/*-----------------------------------------------
* Data
*-----------------------------------------------*/
@ -97,6 +99,10 @@ GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit
pgw->font = defaultFont;
#endif
// Make sure we don't create nasty problems for ourselves
if (vmt->size > sizeof(GWindowObject))
memset(pgw+1, 0, vmt->size - sizeof(GWindowObject));
if (!_gwinWMAdd(pgw, pInit)) {
if ((pgw->flags & GWIN_FLG_DYNAMIC))
gfxFree(pgw);