d-widget-toolkit / org.eclipse.swt.win32.win32.x86

5 stars 6 forks source link

SEGV at Menu#createItem() #6

Closed kntroh closed 12 years ago

kntroh commented 12 years ago

This is code at Menu.java (of SWT):

TCHAR buffer = new TCHAR (0, " ", true);
int byteCount = buffer.length () * TCHAR.sizeof;

If TCHAR class constructed by terminate = true, it will make space of '\0'. Therefore, buffer.length() is 2.

StringT buffer = StrToTCHARs (0, " \0");
int byteCount = (buffer.length-1) * TCHAR.sizeof;

buffer.length-1 of this code must be buffer.length. (buffer.length is 2)

An error occur occasionally in an environment of low on memory.