dinput: Make props array a part of the generic joystick struct.

It's much easier to free it on release.
This commit is contained in:
Vitaliy Margolen 2009-04-19 20:33:27 -06:00 committed by Alexandre Julliard
parent aee4237798
commit 3223798d30
3 changed files with 3 additions and 13 deletions

View File

@ -462,11 +462,6 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
}
newDevice->generic.base.data_format.wine_df = df;
/* create default properties */
newDevice->generic.props = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwNumObjs*sizeof(ObjProps));
if (newDevice->generic.props == 0)
goto FAILED;
/* initialize default properties */
for (i = 0; i < c_dfDIJoystick2.dwNumObjs; i++) {
newDevice->generic.props[i].lDevMin = -32767;
@ -510,7 +505,6 @@ FAILED1:
release_DataFormat(&newDevice->generic.base.data_format);
HeapFree(GetProcessHeap(),0,newDevice->axis_map);
HeapFree(GetProcessHeap(),0,newDevice->generic.name);
HeapFree(GetProcessHeap(),0,newDevice->generic.props);
HeapFree(GetProcessHeap(),0,newDevice);
*pdev = 0;

View File

@ -724,11 +724,6 @@ static HRESULT alloc_device(REFGUID rguid, const void *jvt, IDirectInputImpl *di
}
newDevice->generic.base.data_format.wine_df = df;
/* create default properties */
newDevice->generic.props = HeapAlloc(GetProcessHeap(),0,c_dfDIJoystick2.dwNumObjs*sizeof(ObjProps));
if (newDevice->generic.props == 0)
goto FAILED;
/* initialize default properties */
get_osx_device_elements_props(newDevice);
@ -761,7 +756,6 @@ FAILED:
HeapFree(GetProcessHeap(), 0, df);
release_DataFormat(&newDevice->generic.base.data_format);
HeapFree(GetProcessHeap(),0,newDevice->generic.name);
HeapFree(GetProcessHeap(),0,newDevice->generic.props);
HeapFree(GetProcessHeap(),0,newDevice);
*pdev = 0;

View File

@ -29,6 +29,8 @@
#include "dinput_private.h"
#include "device_private.h"
/* Number of objects in the default data format */
#define MAX_PROPS 164
struct JoystickGenericImpl;
typedef void joy_polldev_handler(struct JoystickGenericImpl *This);
@ -37,7 +39,7 @@ typedef struct JoystickGenericImpl
{
struct IDirectInputDevice2AImpl base;
ObjProps *props;
ObjProps props[MAX_PROPS];
DIDEVCAPS devcaps;
DIJOYSTATE2 js; /* wine data */
GUID guidProduct;