1
0
forked from 0ad/0ad

Fixed mmap bug, and GUI memory leak.

This was SVN commit r2560.
This commit is contained in:
Ykkrosh 2005-07-28 17:39:27 +00:00
parent f4844681a1
commit c3d42c1025
3 changed files with 5 additions and 2 deletions

View File

@ -252,9 +252,11 @@ JSBool JSI_IGUIObject::getProperty(JSContext* cx, JSObject* obj, jsval id, jsval
{
JSString* s = StringConvert::wchars_to_jsstring(cx, value.m_Items[i].GetRawString().c_str());
vector[i] = STRING_TO_JSVAL(s);
// TODO: Make sure these strings never get garbage-collected
}
JSObject *obj = JS_NewArrayObject(cx, (jsint)value.m_Items.size(), vector);
delete[] vector;
*vp = OBJECT_TO_JSVAL(obj);
break;

View File

@ -627,11 +627,12 @@ void* mmap(void* user_start, size_t len, int prot, int flags, int fd, off_t offs
const DWORD len_hi = (DWORD)((u64)len >> 32);
// careful! language doesn't allow shifting 32-bit types by 32 bits.
const DWORD len_lo = (DWORD)len & 0xffffffff;
const HANDLE hMap = CreateFileMapping(hFile, &sec, flProtect, len_hi, len_lo, (LPCSTR)0);
const HANDLE hMap = CreateFileMapping(hFile, psec, flProtect, len_hi, len_lo, (LPCSTR)0);
if(hMap == INVALID_HANDLE_VALUE)
// bail now so that MapView.. doesn't overwrite the last error value.
goto fail;
void* addr = MapViewOfFileEx(hMap, dwAccess, len_hi, offset, len_lo, start);
// TODO: MapViewOfFileEx wants offset_hi rather than len_hi
// free the mapping object now, so that we don't have to hold on to its
// handle until munmap(). it's not actually released yet due to the

View File

@ -170,7 +170,7 @@ PSRETURN PSERROR_System_VmodeFailed::getCode() const { return 0x08000003; }
PSRETURN PSERROR_Xeromyces_XMLOpenFailed::getCode() const { return 0x09000001; }
PSRETURN PSERROR_Xeromyces_XMLParseError::getCode() const { return 0x09000002; }
const char* PSERROR::what() const
const char* PSERROR::what() const throw ()
{
return GetErrorString(getCode());
}