Click here to Skip to main content
15,887,214 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: "Pure WIN32 Self-Extract EXE Builder" not working in Windows 7 Pin
Garth J Lancaster13-Oct-13 16:17
professionalGarth J Lancaster13-Oct-13 16:17 
AnswerRe: "Pure WIN32 Self-Extract EXE Builder" not working in Windows 7 Pin
Richard MacCutchan13-Oct-13 20:44
mveRichard MacCutchan13-Oct-13 20:44 
QuestionImport binary .exe resource in VS2012? Pin
Member 1023629813-Oct-13 12:37
Member 1023629813-Oct-13 12:37 
AnswerRe: Import binary .exe resource in VS2012? Pin
Richard Andrew x6413-Oct-13 14:16
professionalRichard Andrew x6413-Oct-13 14:16 
GeneralRe: Import binary .exe resource in VS2012? Pin
Member 1023629813-Oct-13 14:58
Member 1023629813-Oct-13 14:58 
QuestionSingle click self extracting .exe in Visual c++ 2012? Pin
Member 1033375713-Oct-13 10:45
Member 1033375713-Oct-13 10:45 
QuestionMemory leak with CString Pin
Manoj Kumar Rai12-Oct-13 20:02
professionalManoj Kumar Rai12-Oct-13 20:02 
AnswerRe: Memory leak with CString Pin
Jochen Arndt12-Oct-13 22:31
professionalJochen Arndt12-Oct-13 22:31 
The shown code part of CopyLogToFileByThread() does not change a CString object. So this can't be the source of the leak it is from a CString object.

It seems that you are accessing the m_strLogLine CString object by multiple threads. When doing so, you must use locking. To do so, you may add a CCriticalSection member to your class and use this for locking:
CSingleLock singleLock(&m_CritSection);
singleLock.Lock(); 
CString cstrLogDataBuffer = m_cstrLogLine;
m_cstrLogLine = _T("");
singleLock.Lock();

Use similar code when changing or reading m_strLogLine anywhere.

One more note:
Instead of converting a TCHAR string to char by casting each char, you may use WideCharToMultiByte() or the conversion provided by CString:
C++
// This converts a TCHAR string to char string
CStringA strLineA(cstrLogDataBuffer.GetString());
fwrite(strLineA.GetString(), sizeof(char), strLineA.GetLength(), m_pofLogStream);

GeneralRe: Memory leak with CString Pin
Manoj Kumar Rai13-Oct-13 9:05
professionalManoj Kumar Rai13-Oct-13 9:05 
QuestionRe: Memory leak with CString Pin
David Crow16-Oct-13 4:11
David Crow16-Oct-13 4:11 
QuestionI don't know how to do!? Pin
Suyeong12-Oct-13 17:06
Suyeong12-Oct-13 17:06 
AnswerRe: I don't know how to do!? Pin
Ron Beyer12-Oct-13 17:56
professionalRon Beyer12-Oct-13 17:56 
AnswerRe: I don't know how to do!? Pin
Captain Price14-Oct-13 1:40
professionalCaptain Price14-Oct-13 1:40 
Questionvisual studio 2008 QT project with c++ Pin
Mkhitar Sargsyan12-Oct-13 4:10
Mkhitar Sargsyan12-Oct-13 4:10 
AnswerRe: visual studio 2008 QT project with c++ Pin
Richard MacCutchan12-Oct-13 5:09
mveRichard MacCutchan12-Oct-13 5:09 
GeneralRe: visual studio 2008 QT project with c++ Pin
Mkhitar Sargsyan13-Oct-13 23:35
Mkhitar Sargsyan13-Oct-13 23:35 
GeneralRe: visual studio 2008 QT project with c++ Pin
Richard MacCutchan14-Oct-13 0:00
mveRichard MacCutchan14-Oct-13 0:00 
GeneralRe: visual studio 2008 QT project with c++ Pin
Mkhitar Sargsyan14-Oct-13 0:34
Mkhitar Sargsyan14-Oct-13 0:34 
GeneralRe: visual studio 2008 QT project with c++ Pin
Richard MacCutchan14-Oct-13 1:02
mveRichard MacCutchan14-Oct-13 1:02 
GeneralRe: visual studio 2008 QT project with c++ Pin
Mkhitar Sargsyan14-Oct-13 0:42
Mkhitar Sargsyan14-Oct-13 0:42 
GeneralRe: visual studio 2008 QT project with c++ Pin
Richard MacCutchan14-Oct-13 1:04
mveRichard MacCutchan14-Oct-13 1:04 
GeneralRe: visual studio 2008 QT project with c++ Pin
Mkhitar Sargsyan14-Oct-13 1:20
Mkhitar Sargsyan14-Oct-13 1:20 
GeneralRe: visual studio 2008 QT project with c++ Pin
Richard MacCutchan14-Oct-13 1:51
mveRichard MacCutchan14-Oct-13 1:51 
Questionbcmenu.cpp for XP and 7/8 Pin
DanYELL11-Oct-13 18:39
DanYELL11-Oct-13 18:39 
AnswerRe: bcmenu.cpp for XP and 7/8 Pin
Richard MacCutchan11-Oct-13 22:24
mveRichard MacCutchan11-Oct-13 22:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.