--- SheepShaver/src/video.cpp 2004/12/19 15:14:22 1.11 +++ SheepShaver/src/video.cpp 2005/01/30 21:48:19 1.13 @@ -1,7 +1,7 @@ /* * video.cpp - Video/graphics emulation * - * SheepShaver (C) 1997-2004 Marc Hellwig and Christian Bauer + * SheepShaver (C) 1997-2005 Marc Hellwig and Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -169,7 +169,7 @@ static int16 VideoOpen(uint32 pb, VidLoc // Install and activate interrupt service SheepVar32 theServiceID = 0; - VSLNewInterruptService(Host2MacAddr((uint8 *)csSave->regEntryID), FOURCC('v','b','l',' '), theServiceID.addr()); + VSLNewInterruptService(csSave->regEntryID, FOURCC('v','b','l',' '), theServiceID.addr()); csSave->vslServiceID = theServiceID.value(); D(bug(" Interrupt ServiceID %08lx\n", csSave->vslServiceID)); csSave->interruptsEnabled = true; @@ -885,6 +885,8 @@ int16 VideoDoDriverIO(uint32 spaceID, ui if (private_data != NULL) { // Might be left over from a reboot if (private_data->gammaTable) Mac_sysfree(private_data->gammaTable); + if (private_data->regEntryID) + Mac_sysfree(private_data->regEntryID); } delete private_data; @@ -926,14 +928,24 @@ int16 VideoDoDriverIO(uint32 spaceID, ui private_data = new VidLocals; private_data->gammaTable = 0; - Mac2Host_memcpy(&private_data->regEntryID, commandContents + 2, 16); // DriverInitInfo.deviceEntry + private_data->regEntryID = Mac_sysalloc(sizeof(RegEntryID)); + if (private_data->regEntryID == 0) { + printf("FATAL: VideoDoDriverIO(): Can't allocate service owner\n"); + err = -1; + break; + } + Mac2Mac_memcpy(private_data->regEntryID, commandContents + 2, 16); // DriverInitInfo.deviceEntry private_data->interruptsEnabled = false; // Disable interrupts break; case kFinalizeCommand: case kSupersededCommand: - if (private_data != NULL && private_data->gammaTable) - Mac_sysfree(private_data->gammaTable); + if (private_data != NULL) { + if (private_data->gammaTable) + Mac_sysfree(private_data->gammaTable); + if (private_data->regEntryID) + Mac_sysfree(private_data->regEntryID); + } delete private_data; private_data = NULL; break;