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:
		| @@ -26,7 +26,6 @@ | ||||
| using namespace std; | ||||
|  | ||||
| hqStrMap* CMeasureCalc::c_VarMap = NULL; | ||||
| int CMeasureCalc::m_Loop = 0; | ||||
|  | ||||
| /* | ||||
| ** CMeasureCalc | ||||
|   | ||||
| @@ -40,7 +40,6 @@ private: | ||||
| 	hqMathParser* m_Parser; | ||||
|  | ||||
| 	static hqStrMap* c_VarMap; | ||||
| 	static int m_Loop; | ||||
|  | ||||
| 	int m_UpdateRandom; | ||||
| 	int m_LowBound; | ||||
|   | ||||
| @@ -109,8 +109,7 @@ void CMeterString::Initialize() | ||||
| 	if(m_FontFamily) delete m_FontFamily; | ||||
| 	m_FontFamily = new FontFamily(m_FontFace.c_str()); | ||||
| 	Status status = m_FontFamily->GetLastStatus(); | ||||
| 	//=================================================== | ||||
| 	/* Matt King Code */ | ||||
|  | ||||
| 	// It couldn't find the font family | ||||
| 	// Therefore we look in the privatefontcollection of this meters MeterWindow | ||||
| 	if(Ok != status) | ||||
| @@ -130,8 +129,6 @@ void CMeterString::Initialize() | ||||
| 		} | ||||
| 		 | ||||
| 	} | ||||
| 	/* Matt King  end */ | ||||
| 	//=================================================== | ||||
|  | ||||
| 	FontStyle style = FontStyleRegular; | ||||
|  | ||||
|   | ||||
| @@ -51,11 +51,12 @@ using namespace Gdiplus; | ||||
|  | ||||
| #define SNAPDISTANCE 10 | ||||
|  | ||||
| int CMeterWindow::m_InstanceCount = 0; | ||||
| int CMeterWindow::c_InstanceCount = 0; | ||||
|  | ||||
| extern CRainmeter* Rainmeter; | ||||
|  | ||||
| MULTIMONITOR_INFO CMeterWindow::m_Monitors = { 0 }; | ||||
|  | ||||
| /*  | ||||
| ** CMeterWindow | ||||
| ** | ||||
| @@ -132,8 +133,9 @@ CMeterWindow::CMeterWindow(std::wstring& path, std::wstring& config, std::wstrin | ||||
| 	m_User32Library = LoadLibrary(L"user32.dll"); | ||||
|  | ||||
| 	m_UpdateCounter = 0; | ||||
| 	m_FontCollection = NULL; | ||||
|  | ||||
| 	m_InstanceCount++; | ||||
| 	c_InstanceCount++; | ||||
| } | ||||
|  | ||||
| /*  | ||||
| @@ -165,18 +167,13 @@ CMeterWindow::~CMeterWindow() | ||||
|  | ||||
| 	if(m_Window) DestroyWindow(m_Window); | ||||
|  | ||||
| 	//=================================================== | ||||
| 	// Matt King Code | ||||
| 	if(m_FontCollection) delete m_FontCollection; | ||||
| 	// Matt King Code End | ||||
| 	//=================================================== | ||||
|  | ||||
|  | ||||
| 	FreeLibrary(m_User32Library); | ||||
|  | ||||
| 	m_InstanceCount--; | ||||
| 	c_InstanceCount--; | ||||
|  | ||||
| 	if (m_InstanceCount == 0) | ||||
| 	if (c_InstanceCount == 0) | ||||
| 	{ | ||||
| 		BOOL Result; | ||||
| 		int counter = 0; | ||||
| @@ -1413,8 +1410,6 @@ void CMeterWindow::ReadSkin() | ||||
| 	m_WindowUpdate = m_Parser.ReadInt(L"Rainmeter", L"Update", m_WindowUpdate); | ||||
| 	m_TransitionUpdate = m_Parser.ReadInt(L"Rainmeter", L"TransitionUpdate", m_TransitionUpdate); | ||||
|  | ||||
| 	//===================================================== | ||||
| 	//Matt King Code | ||||
| 	// Checking for localfonts | ||||
| 	std::wstring localFont1 = m_Parser.ReadString(L"Rainmeter", L"LocalFont", L""); | ||||
| 	// If there is a local font we want to load it | ||||
| @@ -1506,9 +1501,6 @@ void CMeterWindow::ReadSkin() | ||||
| 			i++; | ||||
| 		} while(loop); | ||||
| 	} | ||||
| 	//Matt King code end | ||||
| 	//===================================================== | ||||
|  | ||||
|  | ||||
| 	// Create the meters and measures | ||||
|  | ||||
|   | ||||
| @@ -175,10 +175,7 @@ public: | ||||
|  | ||||
| 	std::wstring MakePathAbsolute(std::wstring path); | ||||
|  | ||||
| 	//======================================================== | ||||
| 	//MattKing Code | ||||
| 	Gdiplus::PrivateFontCollection* GetPrivateFontCollection(){ return m_FontCollection; } | ||||
| 	//MattKing Code End | ||||
|  | ||||
| protected: | ||||
| 	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 | ||||
|  | ||||
| 	static int m_InstanceCount; | ||||
| 	static int c_InstanceCount; | ||||
|  | ||||
| 	//========================================================== | ||||
| 	//MattKing code | ||||
| 	Gdiplus::PrivateFontCollection* m_FontCollection; | ||||
| 	//MattKing end | ||||
| }; | ||||
|  | ||||
| #endif | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kimmo Pekkola
					Kimmo Pekkola