• R/O
  • HTTP
  • SSH
  • HTTPS

winmerge-jp: Commit


Commit MetaInfo

Revisiónd4950cd3d124d0c940d19ab97c532277d807e760 (tree)
Tiempo2015-02-27 20:28:48
Autorsdottaka <sdottaka@user...>
Commitersdottaka

Log Message

Fix memory leak

--HG--
branch : stable

Cambiar Resumen

Diferencia incremental

--- a/Src/MergeDoc.cpp
+++ b/Src/MergeDoc.cpp
@@ -141,7 +141,7 @@ CMergeDoc::CMergeDoc()
141141 , m_pDirDoc(NULL)
142142 , m_bMixedEol(false)
143143 , m_pInfoUnpacker(new PackingInfo)
144-, m_pEncodingErrorBar(NULL)
144+, m_pEncodingErrorBar(nullptr)
145145 , m_bHasSyncPoints(false)
146146 , m_bAutoMerged(false)
147147 {
@@ -2615,11 +2615,11 @@ OPENRESULTS_TYPE CMergeDoc::OpenDocs(FileLocation fileloc[],
26152615 {
26162616 if (!m_pEncodingErrorBar)
26172617 {
2618- m_pEncodingErrorBar = new CEncodingErrorBar();
2618+ m_pEncodingErrorBar.reset(new CEncodingErrorBar());
26192619 m_pEncodingErrorBar->Create(this->m_pView[0]->GetParentFrame());
26202620 }
26212621 m_pEncodingErrorBar->SetText(LoadResString(idres).c_str());
2622- m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar, TRUE, FALSE);
2622+ m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar.get(), TRUE, FALSE);
26232623 }
26242624
26252625 for (nBuffer = 0; nBuffer < m_nBuffers; nBuffer++)
@@ -3109,13 +3109,13 @@ void CMergeDoc::OnUpdateCtxtOpenWithUnpacker(CCmdUI* pCmdUI)
31093109
31103110 void CMergeDoc::OnBnClickedFileEncoding()
31113111 {
3112- m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar, FALSE, FALSE);
3112+ m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar.get(), FALSE, FALSE);
31133113 DoFileEncodingDialog();
31143114 }
31153115
31163116 void CMergeDoc::OnBnClickedPlugin()
31173117 {
3118- m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar, FALSE, FALSE);
3118+ m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar.get(), FALSE, FALSE);
31193119 OpenWithUnpackerDialog();
31203120 }
31213121
@@ -3125,7 +3125,7 @@ void CMergeDoc::OnBnClickedHexView()
31253125 for (int pane = 0; pane < m_nBuffers; pane++)
31263126 bRO[pane] = m_ptBuf[pane]->GetReadOnly();
31273127 if (m_pEncodingErrorBar && m_pEncodingErrorBar->IsWindowVisible())
3128- m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar, FALSE, FALSE);
3128+ m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar.get(), FALSE, FALSE);
31293129 GetMainFrame()->ShowHexMergeDoc(m_pDirDoc, m_filePaths, bRO);
31303130 GetParentFrame()->ShowWindow(SW_RESTORE);
31313131 GetParentFrame()->DestroyWindow();
@@ -3133,7 +3133,7 @@ void CMergeDoc::OnBnClickedHexView()
31333133
31343134 void CMergeDoc::OnOK()
31353135 {
3136- m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar, FALSE, FALSE);
3136+ m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar.get(), FALSE, FALSE);
31373137 }
31383138
31393139 void CMergeDoc::OnFileRecompareAsXML()
--- a/Src/MergeDoc.h
+++ b/Src/MergeDoc.h
@@ -321,7 +321,7 @@ protected:
321321 TempFile m_tempFiles[3]; /**< Temp files for compared files */
322322 int m_nDiffContext;
323323 bool m_bMixedEol; /**< Does this document have mixed EOL style? */
324- CEncodingErrorBar *m_pEncodingErrorBar;
324+ std::unique_ptr<CEncodingErrorBar> m_pEncodingErrorBar;
325325 bool m_bHasSyncPoints;
326326 bool m_bAutoMerged;
327327 // friend access
Show on old repository browser