Fixed a possible NULL-pointer access in DWMAPI wrapper code when DWM is not available.
This commit is contained in:
parent
3d5b9541ed
commit
0bc1157906
@ -23,7 +23,6 @@
|
||||
<file>images/Logo_GNU.png</file>
|
||||
<file>images/Logo_Software.png</file>
|
||||
<file>images/Qt.svg</file>
|
||||
<file>images/Splash.png</file>
|
||||
<file>images/Sound.png</file>
|
||||
<file>images/Starting.png</file>
|
||||
<file>images/Thumb.png</file>
|
||||
|
@ -35,7 +35,7 @@
|
||||
#define VER_LAMEXP_MINOR_LO 9
|
||||
#define VER_LAMEXP_TYPE Alpha
|
||||
#define VER_LAMEXP_PATCH 8
|
||||
#define VER_LAMEXP_BUILD 1470
|
||||
#define VER_LAMEXP_BUILD 1472
|
||||
#define VER_LAMEXP_CONFG 1348
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -173,10 +173,10 @@ g_lamexp_themes_enabled;
|
||||
static struct
|
||||
{
|
||||
bool bInitialized;
|
||||
QLibrary *dwmapi_dll;
|
||||
HRESULT (__stdcall *dwmIsCompositionEnabled)(BOOL *bEnabled);
|
||||
HRESULT (__stdcall *dwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS* pMarInset);
|
||||
HRESULT (__stdcall *dwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND* pBlurBehind);
|
||||
QLibrary *dwmapi_dll;
|
||||
QReadWriteLock lock;
|
||||
}
|
||||
g_lamexp_dwmapi;
|
||||
@ -1858,14 +1858,14 @@ bool lamexp_open_media_file(const QString &mediaFilePath)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool lamexp_init_dwmapi(void)
|
||||
static void lamexp_init_dwmapi(void)
|
||||
{
|
||||
QReadLocker writeLock(&g_lamexp_dwmapi.lock);
|
||||
|
||||
//Not initialized yet?
|
||||
if(g_lamexp_dwmapi.bInitialized)
|
||||
{
|
||||
return (g_lamexp_dwmapi.dwmIsCompositionEnabled != NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
//Reset function pointers
|
||||
@ -1893,7 +1893,6 @@ static bool lamexp_init_dwmapi(void)
|
||||
}
|
||||
|
||||
g_lamexp_dwmapi.bInitialized = true;
|
||||
return (g_lamexp_dwmapi.dwmIsCompositionEnabled != NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1907,20 +1906,25 @@ bool lamexp_sheet_of_glass(QWidget *window)
|
||||
while(!g_lamexp_dwmapi.bInitialized)
|
||||
{
|
||||
readLock.unlock();
|
||||
if(!lamexp_init_dwmapi()) return false;
|
||||
lamexp_init_dwmapi();
|
||||
readLock.relock();
|
||||
}
|
||||
|
||||
//Check if composition is enabled
|
||||
BOOL bEnabled = FALSE;
|
||||
if(HRESULT hr = g_lamexp_dwmapi.dwmIsCompositionEnabled(&bEnabled))
|
||||
BOOL bCompositionEnabled = FALSE;
|
||||
|
||||
//Required functions available?
|
||||
if((g_lamexp_dwmapi.dwmIsCompositionEnabled != NULL) && (g_lamexp_dwmapi.dwmExtendFrameIntoClientArea != NULL) && (g_lamexp_dwmapi.dwmEnableBlurBehindWindow != NULL))
|
||||
{
|
||||
qWarning("DwmIsCompositionEnabled function has failed! (error %d)", hr);
|
||||
return false;
|
||||
//Check if composition is currently enabled
|
||||
if(HRESULT hr = g_lamexp_dwmapi.dwmIsCompositionEnabled(&bCompositionEnabled))
|
||||
{
|
||||
qWarning("DwmIsCompositionEnabled function has failed! (error %d)", hr);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Composition enabled and required functions available?
|
||||
if((!bEnabled) || (g_lamexp_dwmapi.dwmExtendFrameIntoClientArea == NULL) || (g_lamexp_dwmapi.dwmEnableBlurBehindWindow == NULL))
|
||||
//All functions available *and* composition enabled?
|
||||
if(!bCompositionEnabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1963,20 +1967,25 @@ bool lamexp_sheet_of_glass_update(QWidget *window)
|
||||
while(!g_lamexp_dwmapi.bInitialized)
|
||||
{
|
||||
readLock.unlock();
|
||||
if(!lamexp_init_dwmapi()) return false;
|
||||
lamexp_init_dwmapi();
|
||||
readLock.relock();
|
||||
}
|
||||
|
||||
//Check if composition is enabled
|
||||
BOOL bEnabled = FALSE;
|
||||
if(HRESULT hr = g_lamexp_dwmapi.dwmIsCompositionEnabled(&bEnabled))
|
||||
BOOL bCompositionEnabled = FALSE;
|
||||
|
||||
//Required functions available?
|
||||
if((g_lamexp_dwmapi.dwmIsCompositionEnabled != NULL) && (g_lamexp_dwmapi.dwmEnableBlurBehindWindow != NULL))
|
||||
{
|
||||
qWarning("DwmIsCompositionEnabled function has failed! (error %d)", hr);
|
||||
return false;
|
||||
//Check if composition is currently enabled
|
||||
if(HRESULT hr = g_lamexp_dwmapi.dwmIsCompositionEnabled(&bCompositionEnabled))
|
||||
{
|
||||
qWarning("DwmIsCompositionEnabled function has failed! (error %d)", hr);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//Composition enabled and required functions available?
|
||||
if((!bEnabled) || (g_lamexp_dwmapi.dwmEnableBlurBehindWindow == NULL))
|
||||
//All functions available *and* composition enabled?
|
||||
if(!bCompositionEnabled)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user