Browse Source

small changes
[SAB]


git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@191 595ec19a-5cb4-439b-94a8-42fb3063c22c

sabrogden 20 years ago
parent
commit
be042709b5
2 changed files with 16 additions and 12 deletions
  1. 1 1
      CP_Main.cpp
  2. 15 11
      CopyThread.cpp

+ 1 - 1
CP_Main.cpp

@@ -104,7 +104,7 @@ BOOL CCP_MainApp::InitInstance()
 	AfxInitRichEdit();
 
 	CString csFile = CGetSetOptions::GetLanguageFile();
-	if(!m_Language.LoadLanguageFile(csFile))
+	if(csFile.GetLength() > 0 && !m_Language.LoadLanguageFile(csFile))
 	{
 		CString cs;
 		cs.Format("Error loading language file - %s - \n\n%s", csFile, m_Language.m_csLastError);

+ 15 - 11
CopyThread.cpp

@@ -16,14 +16,14 @@ static char THIS_FILE[] = __FILE__;
 
 IMPLEMENT_DYNCREATE(CCopyThread, CWinThread)
 
-CCopyThread::CCopyThread()
+CCopyThread::CCopyThread():
+	m_bQuit(false),
+	m_bConfigChanged(false),
+	m_pClips(NULL),
+	m_pClipboardViewer(NULL)
 {
-	m_bQuit = false;
-	m_bAutoDelete = false;
-	
-	m_bConfigChanged = false;
-	m_pClips = new CClipList;
-	m_pClipboardViewer = new CClipboardViewer(this);
+	m_bAutoDelete = false,
+
 	::InitializeCriticalSection(&m_CS);
 }
 
@@ -31,10 +31,8 @@ CCopyThread::~CCopyThread()
 {
 	m_LocalConfig.DeleteTypes();
 	m_SharedConfig.DeleteTypes();
-	DELETE_PTR( m_pClipboardViewer );
-	if( m_pClips )
-		ASSERT( m_pClips->GetCount() == 0 );
-	DELETE_PTR( m_pClips );
+	DELETE_PTR(m_pClipboardViewer);
+	DELETE_PTR(m_pClips);
 	::DeleteCriticalSection(&m_CS);
 }
 
@@ -42,6 +40,8 @@ BOOL CCopyThread::InitInstance()
 {
 	SetThreadName(m_nThreadID, "COPY");
 
+	m_pClipboardViewer = new CClipboardViewer(this);
+
 	// the window is created within this thread and therefore uses its message queue
 	m_pClipboardViewer->Create();
 
@@ -123,10 +123,12 @@ void CCopyThread::SyncConfig()
 void CCopyThread::AddToClips(CClip* pClip)
 {
 	Hold();
+
 	if(!m_pClips)
 		m_pClips = new CClipList;
 
 	m_pClips->AddTail(pClip); // m_pClips now owns pClip
+
 	Release();
 }
 
@@ -153,8 +155,10 @@ void CCopyThread::SetConnectCV(bool bConnect)
 CClipList* CCopyThread::GetClips()
 {
 	Hold();
+	
 	CClipList* pRet = m_pClips;
 	m_pClips = NULL;
+
 	Release();
 	return pRet;
 }