# HG changeset patch # User a.parshin # Date 1431592480 -7200 # Node ID 67d837007a4c217d08e82d7a855f7425b0f22e7f # Parent f2a8ed07e921515aed74647c2681f5d5b32795d6 ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows & d3d deinit crashes fixed diff -r f2a8ed07e921 -r 67d837007a4c Engine/Engine.cpp --- a/Engine/Engine.cpp Wed May 13 11:31:58 2015 +0200 +++ b/Engine/Engine.cpp Thu May 14 10:34:40 2015 +0200 @@ -2094,8 +2094,6 @@ //----- (00464479) -------------------------------------------------------- void ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows() { - int v0; // esi@9 - if (pMouse) pMouse->SetCursorBitmap("MICON1"); @@ -2113,13 +2111,15 @@ pSoundList->_4A9D79(0); uCurrentlyLoadedLevelType = LEVEL_null; pSpriteFrameTable->ResetSomeSpriteFlags(); - v0 = uNumVisibleWindows; pParty->armageddon_timer = 0; - while (v0 > 0) + + while (uNumVisibleWindows > 0) { - pWindowList[pVisibleWindowsIdxs[v0--] - 1]->Release(); - delete pWindowList[pVisibleWindowsIdxs[v0--] - 1]; - pWindowList[pVisibleWindowsIdxs[v0--] - 1] = nullptr; + pWindowList[pVisibleWindowsIdxs[uNumVisibleWindows] - 1]->Release(); + delete pWindowList[pVisibleWindowsIdxs[uNumVisibleWindows] - 1]; + pWindowList[pVisibleWindowsIdxs[uNumVisibleWindows] - 1] = nullptr; + + uNumVisibleWindows--; } } diff -r f2a8ed07e921 -r 67d837007a4c Engine/Graphics/Render.cpp --- a/Engine/Graphics/Render.cpp Wed May 13 11:31:58 2015 +0200 +++ b/Engine/Graphics/Render.cpp Thu May 14 10:34:40 2015 +0200 @@ -1250,28 +1250,49 @@ } } - for (int i = 0; i < 4; i++) - { - delete[] this->pAvailableDevices[i].pDriverName; - this->pAvailableDevices[i].pDriverName = nullptr; - - delete[] this->pAvailableDevices[i].pDeviceDesc; - this->pAvailableDevices[i].pDeviceDesc = nullptr; - - delete[] this->pAvailableDevices[i].pDDraw4DevDesc; - this->pAvailableDevices[i].pDDraw4DevDesc = nullptr; - - delete this->pAvailableDevices[i].pDirectDrawGUID; - this->pAvailableDevices[i].pDirectDrawGUID = nullptr; - - delete[] this->pAvailableDevices[i].pName; - this->pAvailableDevices[i].pName = nullptr; - - delete[] this->pAvailableDevices[i].pDescription; - this->pAvailableDevices[i].pDescription = nullptr; - - delete this->pAvailableDevices[i].pGUID; - this->pAvailableDevices[i].pGUID = nullptr; + for (int i = 0; i < 4; i++) + { + if (this->pAvailableDevices[i].pDriverName) + { + delete[] this->pAvailableDevices[i].pDriverName; + this->pAvailableDevices[i].pDriverName = nullptr; + } + + if (this->pAvailableDevices[i].pDeviceDesc) + { + delete[] this->pAvailableDevices[i].pDeviceDesc; + this->pAvailableDevices[i].pDeviceDesc = nullptr; + } + + if (this->pAvailableDevices[i].pDDraw4DevDesc) + { + delete[] this->pAvailableDevices[i].pDDraw4DevDesc; + this->pAvailableDevices[i].pDDraw4DevDesc = nullptr; + } + + if (this->pAvailableDevices[i].pDirectDrawGUID) + { + delete this->pAvailableDevices[i].pDirectDrawGUID; + this->pAvailableDevices[i].pDirectDrawGUID = nullptr; + } + + if (this->pAvailableDevices[i].pName) + { + delete[] this->pAvailableDevices[i].pName; + this->pAvailableDevices[i].pName = nullptr; + } + + if (this->pAvailableDevices[i].pDescription) + { + delete[] this->pAvailableDevices[i].pDescription; + this->pAvailableDevices[i].pDescription = nullptr; + } + + if (this->pAvailableDevices[i].pGUID) + { + delete this->pAvailableDevices[i].pGUID; + this->pAvailableDevices[i].pGUID = nullptr; + } } delete[] this->pAvailableDevices; diff -r f2a8ed07e921 -r 67d837007a4c Engine/Graphics/RenderStruct.h --- a/Engine/Graphics/RenderStruct.h Wed May 13 11:31:58 2015 +0200 +++ b/Engine/Graphics/RenderStruct.h Thu May 14 10:34:40 2015 +0200 @@ -105,6 +105,12 @@ #pragma pack(push, 1) struct RenderD3D__DevInfo { + inline RenderD3D__DevInfo(): + bIsDeviceCompatible(false), pName(nullptr), pDescription(nullptr), + pGUID(nullptr), uCaps(0), pDriverName(nullptr), pDeviceDesc(nullptr), + pDDraw4DevDesc(nullptr), pDirectDrawGUID(nullptr), uVideoMem(0) + {} + unsigned int bIsDeviceCompatible; char *pName; char *pDescription;