Merge pull request #630 from UnknownShadow200/develop
Allocate SystemDefaultCharSize instead of 1 byte per char for buffer used in WinGLNative.HandleDropFiles
This commit is contained in:
commit
feb8e8f6e3
1 changed files with 5 additions and 5 deletions
|
@ -692,15 +692,15 @@ namespace OpenTK.Platform.Windows
|
||||||
for (uint i = 0; i < filesCounter; ++i)
|
for (uint i = 0; i < filesCounter; ++i)
|
||||||
{
|
{
|
||||||
// Don't forget about \0 at the end
|
// Don't forget about \0 at the end
|
||||||
uint fileNameSize = Functions.DragQueryFile(hDrop, i, IntPtr.Zero, 0) + 1;
|
uint filenameChars = Functions.DragQueryFile(hDrop, i, IntPtr.Zero, 0) + 1;
|
||||||
IntPtr str = Marshal.AllocHGlobal((int)fileNameSize);
|
int filenameSize = (int)(filenameChars * Marshal.SystemDefaultCharSize);
|
||||||
|
IntPtr str = Marshal.AllocHGlobal(filenameSize);
|
||||||
|
|
||||||
Functions.DragQueryFile(hDrop, i, str, fileNameSize);
|
Functions.DragQueryFile(hDrop, i, str, filenameChars);
|
||||||
|
|
||||||
string dropString = Marshal.PtrToStringAuto(str);
|
string dropString = Marshal.PtrToStringAuto(str);
|
||||||
OnFileDrop(dropString);
|
|
||||||
|
|
||||||
Marshal.FreeHGlobal(str);
|
Marshal.FreeHGlobal(str);
|
||||||
|
OnFileDrop(dropString);
|
||||||
}
|
}
|
||||||
|
|
||||||
Functions.DragFinish(hDrop);
|
Functions.DragFinish(hDrop);
|
||||||
|
|
Loading…
Reference in a new issue