From 9fbed1af34ed8b93ca7e58b6ddca646a0f2af0ec Mon Sep 17 00:00:00 2001 From: nillerusr Date: Sun, 8 Oct 2023 07:31:07 +0300 Subject: [PATCH] fix crash in some cases --- common/imageutils.cpp | 5 ++++- engine/gl_rsurf.cpp | 2 +- filesystem/basefilesystem.cpp | 2 +- public/mathlib/mathlib.h | 2 +- vgui2/vgui_controls/FileOpenDialog.cpp | 3 +++ wscript | 4 ++-- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/common/imageutils.cpp b/common/imageutils.cpp index 7c690aefe3..5bb0b7415c 100644 --- a/common/imageutils.cpp +++ b/common/imageutils.cpp @@ -65,9 +65,12 @@ extern void longjmp( jmp_buf, int ) __attribute__((noreturn)); #define JPEGLIB_USE_STDIO #if ANDROID #include "android/jpeglib/jpeglib.h" -#else +#elif defined WIN32 #include "jpeglib/jpeglib.h" +#else +#include #endif + #undef JPEGLIB_USE_STDIO diff --git a/engine/gl_rsurf.cpp b/engine/gl_rsurf.cpp index de87c60b8c..5731704ce8 100644 --- a/engine/gl_rsurf.cpp +++ b/engine/gl_rsurf.cpp @@ -4934,7 +4934,7 @@ static bool EnumerateLeafInBox_R(mnode_t * RESTRICT node, const EnumLeafBoxInfo_ */ // take advantage of high throughput/high latency - fltx4 planeNormal = LoadAlignedSIMD( plane->normal.Base() ); + fltx4 planeNormal = LoadUnaligned3SIMD( plane->normal.Base() ); fltx4 vecBoxMin = LoadAlignedSIMD(pInfo->m_vecBoxMin); fltx4 vecBoxMax = LoadAlignedSIMD(pInfo->m_vecBoxMax); fltx4 cornermin, cornermax; diff --git a/filesystem/basefilesystem.cpp b/filesystem/basefilesystem.cpp index 26bb8372a2..aad384349a 100644 --- a/filesystem/basefilesystem.cpp +++ b/filesystem/basefilesystem.cpp @@ -4203,7 +4203,7 @@ bool CBaseFileSystem::FindNextFileInVPKOrPakHelper( FindData_t *pFindData ) { V_strncpy( pFindData->findData.cFileName, V_UnqualifiedFileName( pFindData->m_fileMatchesFromVPKOrPak[0] ), sizeof( pFindData->findData.cFileName ) ); pFindData->findData.dwFileAttributes = 0; - delete pFindData->m_fileMatchesFromVPKOrPak.Head(); + delete[] pFindData->m_fileMatchesFromVPKOrPak.Head(); pFindData->m_fileMatchesFromVPKOrPak.RemoveMultipleFromHead( 1 ); return true; diff --git a/public/mathlib/mathlib.h b/public/mathlib/mathlib.h index 6503da0f59..1e8e0266ea 100644 --- a/public/mathlib/mathlib.h +++ b/public/mathlib/mathlib.h @@ -114,7 +114,7 @@ inline T clamp( T const &val, T const &minVal, T const &maxVal ) // FIXME: this should move to a different file struct cplane_t { - VectorAligned normal; + Vector normal; float dist; byte type; // for fast side tests byte signbits; // signx + (signy<<1) + (signz<<1) diff --git a/vgui2/vgui_controls/FileOpenDialog.cpp b/vgui2/vgui_controls/FileOpenDialog.cpp index d4a098fcb1..aa481da0db 100644 --- a/vgui2/vgui_controls/FileOpenDialog.cpp +++ b/vgui2/vgui_controls/FileOpenDialog.cpp @@ -1500,6 +1500,9 @@ void FileOpenDialog::OnOpen() char pFileName[MAX_PATH]; GetSelectedFileName( pFileName, sizeof( pFileName ) ); + if( !pFileName[0] ) + return; + int nLen = Q_strlen( pFileName ); bool bSpecifiedDirectory = ( pFileName[nLen-1] == '/' || pFileName[nLen-1] == '\\' ) && (!IsOSX() || ( IsOSX() && !Q_stristr( pFileName, ".app" ) ) ); Q_StripTrailingSlash( pFileName ); diff --git a/wscript b/wscript index 9910b29a40..7f760500ba 100644 --- a/wscript +++ b/wscript @@ -239,9 +239,9 @@ def define_platform(conf): '_DLL_EXT=.so' ]) -# if conf.env.DEST_OS != 'win32': + if conf.env.DEST_OS != 'win32': + conf.define('NO_MEMOVERRIDE_NEW_DELETE', 1) # conf.define('NO_MALLOC_OVERRIDE', 1) -# conf.define('NO_MEMOVERRIDE_NEW_DELETE', 1) if conf.options.DEBUG_ENGINE: conf.env.append_unique('DEFINES', [