mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
The m_FontCollection wasn't initialized so it could cause a crash on exit.
Some code cleanup.
This commit is contained in:
parent
4bf4e51126
commit
4274397806
@ -26,7 +26,6 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
hqStrMap* CMeasureCalc::c_VarMap = NULL;
|
hqStrMap* CMeasureCalc::c_VarMap = NULL;
|
||||||
int CMeasureCalc::m_Loop = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CMeasureCalc
|
** CMeasureCalc
|
||||||
|
@ -40,7 +40,6 @@ private:
|
|||||||
hqMathParser* m_Parser;
|
hqMathParser* m_Parser;
|
||||||
|
|
||||||
static hqStrMap* c_VarMap;
|
static hqStrMap* c_VarMap;
|
||||||
static int m_Loop;
|
|
||||||
|
|
||||||
int m_UpdateRandom;
|
int m_UpdateRandom;
|
||||||
int m_LowBound;
|
int m_LowBound;
|
||||||
|
@ -109,8 +109,7 @@ void CMeterString::Initialize()
|
|||||||
if(m_FontFamily) delete m_FontFamily;
|
if(m_FontFamily) delete m_FontFamily;
|
||||||
m_FontFamily = new FontFamily(m_FontFace.c_str());
|
m_FontFamily = new FontFamily(m_FontFace.c_str());
|
||||||
Status status = m_FontFamily->GetLastStatus();
|
Status status = m_FontFamily->GetLastStatus();
|
||||||
//===================================================
|
|
||||||
/* Matt King Code */
|
|
||||||
// It couldn't find the font family
|
// It couldn't find the font family
|
||||||
// Therefore we look in the privatefontcollection of this meters MeterWindow
|
// Therefore we look in the privatefontcollection of this meters MeterWindow
|
||||||
if(Ok != status)
|
if(Ok != status)
|
||||||
@ -130,8 +129,6 @@ void CMeterString::Initialize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
/* Matt King end */
|
|
||||||
//===================================================
|
|
||||||
|
|
||||||
FontStyle style = FontStyleRegular;
|
FontStyle style = FontStyleRegular;
|
||||||
|
|
||||||
|
@ -51,11 +51,12 @@ using namespace Gdiplus;
|
|||||||
|
|
||||||
#define SNAPDISTANCE 10
|
#define SNAPDISTANCE 10
|
||||||
|
|
||||||
int CMeterWindow::m_InstanceCount = 0;
|
int CMeterWindow::c_InstanceCount = 0;
|
||||||
|
|
||||||
extern CRainmeter* Rainmeter;
|
extern CRainmeter* Rainmeter;
|
||||||
|
|
||||||
MULTIMONITOR_INFO CMeterWindow::m_Monitors = { 0 };
|
MULTIMONITOR_INFO CMeterWindow::m_Monitors = { 0 };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CMeterWindow
|
** CMeterWindow
|
||||||
**
|
**
|
||||||
@ -132,8 +133,9 @@ CMeterWindow::CMeterWindow(std::wstring& path, std::wstring& config, std::wstrin
|
|||||||
m_User32Library = LoadLibrary(L"user32.dll");
|
m_User32Library = LoadLibrary(L"user32.dll");
|
||||||
|
|
||||||
m_UpdateCounter = 0;
|
m_UpdateCounter = 0;
|
||||||
|
m_FontCollection = NULL;
|
||||||
|
|
||||||
m_InstanceCount++;
|
c_InstanceCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -165,18 +167,13 @@ CMeterWindow::~CMeterWindow()
|
|||||||
|
|
||||||
if(m_Window) DestroyWindow(m_Window);
|
if(m_Window) DestroyWindow(m_Window);
|
||||||
|
|
||||||
//===================================================
|
|
||||||
// Matt King Code
|
|
||||||
if(m_FontCollection) delete m_FontCollection;
|
if(m_FontCollection) delete m_FontCollection;
|
||||||
// Matt King Code End
|
|
||||||
//===================================================
|
|
||||||
|
|
||||||
|
|
||||||
FreeLibrary(m_User32Library);
|
FreeLibrary(m_User32Library);
|
||||||
|
|
||||||
m_InstanceCount--;
|
c_InstanceCount--;
|
||||||
|
|
||||||
if (m_InstanceCount == 0)
|
if (c_InstanceCount == 0)
|
||||||
{
|
{
|
||||||
BOOL Result;
|
BOOL Result;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
@ -1413,8 +1410,6 @@ void CMeterWindow::ReadSkin()
|
|||||||
m_WindowUpdate = m_Parser.ReadInt(L"Rainmeter", L"Update", m_WindowUpdate);
|
m_WindowUpdate = m_Parser.ReadInt(L"Rainmeter", L"Update", m_WindowUpdate);
|
||||||
m_TransitionUpdate = m_Parser.ReadInt(L"Rainmeter", L"TransitionUpdate", m_TransitionUpdate);
|
m_TransitionUpdate = m_Parser.ReadInt(L"Rainmeter", L"TransitionUpdate", m_TransitionUpdate);
|
||||||
|
|
||||||
//=====================================================
|
|
||||||
//Matt King Code
|
|
||||||
// Checking for localfonts
|
// Checking for localfonts
|
||||||
std::wstring localFont1 = m_Parser.ReadString(L"Rainmeter", L"LocalFont", L"");
|
std::wstring localFont1 = m_Parser.ReadString(L"Rainmeter", L"LocalFont", L"");
|
||||||
// If there is a local font we want to load it
|
// If there is a local font we want to load it
|
||||||
@ -1506,9 +1501,6 @@ void CMeterWindow::ReadSkin()
|
|||||||
i++;
|
i++;
|
||||||
} while(loop);
|
} while(loop);
|
||||||
}
|
}
|
||||||
//Matt King code end
|
|
||||||
//=====================================================
|
|
||||||
|
|
||||||
|
|
||||||
// Create the meters and measures
|
// Create the meters and measures
|
||||||
|
|
||||||
|
@ -175,10 +175,7 @@ public:
|
|||||||
|
|
||||||
std::wstring MakePathAbsolute(std::wstring path);
|
std::wstring MakePathAbsolute(std::wstring path);
|
||||||
|
|
||||||
//========================================================
|
|
||||||
//MattKing Code
|
|
||||||
Gdiplus::PrivateFontCollection* GetPrivateFontCollection(){ return m_FontCollection; }
|
Gdiplus::PrivateFontCollection* GetPrivateFontCollection(){ return m_FontCollection; }
|
||||||
//MattKing Code End
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
static LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
@ -320,12 +317,9 @@ private:
|
|||||||
|
|
||||||
CRainmeter* m_Rainmeter; // Pointer to the main object
|
CRainmeter* m_Rainmeter; // Pointer to the main object
|
||||||
|
|
||||||
static int m_InstanceCount;
|
static int c_InstanceCount;
|
||||||
|
|
||||||
//==========================================================
|
|
||||||
//MattKing code
|
|
||||||
Gdiplus::PrivateFontCollection* m_FontCollection;
|
Gdiplus::PrivateFontCollection* m_FontCollection;
|
||||||
//MattKing end
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user