Thread: Winamp 5.55 SDK
View Single Post
Old 7th November 2007, 22:37   #81
Maxim
Senior Member
 
Join Date: Mar 2001
Location: smspower.org
Posts: 107
Re: Backwards compatibility fix for Global Config

Quote:
Originally posted by Benski
code:
api_config *GetConfigAPI()
{
if (!serviceApi)
{
serviceApi = (api_service *)SendMessage(mod.hMainWindow, WM_WA_IPC, 0, IPC_GET_API_SERVICE);
}

if (serviceApi && !configApi)
{
waServiceFactory *sf= (waServiceFactory *)serviceApi->service_getServiceByGuid(AgaveConfigGUID);
configApi = (api_config *)sf->getInterface();
}

return configApi;
}

Bugfix 2:
code:
api_config *GetConfigAPI()
{
if (!serviceApi)
{
serviceApi = (api_service *)SendMessage(mod.hMainWindow, WM_WA_IPC, 0, IPC_GET_API_SERVICE);
}

if ((int)serviceApi == 1)
return NULL;

if (serviceApi && !configApi)
{
waServiceFactory *sf= (waServiceFactory *)serviceApi->service_getServiceByGuid(AgaveConfigGUID);
if (!sf)
return NULL;

configApi = (api_config *)sf->getInterface();
}

return configApi;
}


Older Winamps crash without the second check.
Maxim is offline   Reply With Quote