Revisión | d4950cd3d124d0c940d19ab97c532277d807e760 (tree) |
---|---|
Tiempo | 2015-02-27 20:28:48 |
Autor | sdottaka <sdottaka@user...> |
Commiter | sdottaka |
Fix memory leak
--HG--
branch : stable
@@ -141,7 +141,7 @@ CMergeDoc::CMergeDoc() | ||
141 | 141 | , m_pDirDoc(NULL) |
142 | 142 | , m_bMixedEol(false) |
143 | 143 | , m_pInfoUnpacker(new PackingInfo) |
144 | -, m_pEncodingErrorBar(NULL) | |
144 | +, m_pEncodingErrorBar(nullptr) | |
145 | 145 | , m_bHasSyncPoints(false) |
146 | 146 | , m_bAutoMerged(false) |
147 | 147 | { |
@@ -2615,11 +2615,11 @@ OPENRESULTS_TYPE CMergeDoc::OpenDocs(FileLocation fileloc[], | ||
2615 | 2615 | { |
2616 | 2616 | if (!m_pEncodingErrorBar) |
2617 | 2617 | { |
2618 | - m_pEncodingErrorBar = new CEncodingErrorBar(); | |
2618 | + m_pEncodingErrorBar.reset(new CEncodingErrorBar()); | |
2619 | 2619 | m_pEncodingErrorBar->Create(this->m_pView[0]->GetParentFrame()); |
2620 | 2620 | } |
2621 | 2621 | 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); | |
2623 | 2623 | } |
2624 | 2624 | |
2625 | 2625 | for (nBuffer = 0; nBuffer < m_nBuffers; nBuffer++) |
@@ -3109,13 +3109,13 @@ void CMergeDoc::OnUpdateCtxtOpenWithUnpacker(CCmdUI* pCmdUI) | ||
3109 | 3109 | |
3110 | 3110 | void CMergeDoc::OnBnClickedFileEncoding() |
3111 | 3111 | { |
3112 | - m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar, FALSE, FALSE); | |
3112 | + m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar.get(), FALSE, FALSE); | |
3113 | 3113 | DoFileEncodingDialog(); |
3114 | 3114 | } |
3115 | 3115 | |
3116 | 3116 | void CMergeDoc::OnBnClickedPlugin() |
3117 | 3117 | { |
3118 | - m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar, FALSE, FALSE); | |
3118 | + m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar.get(), FALSE, FALSE); | |
3119 | 3119 | OpenWithUnpackerDialog(); |
3120 | 3120 | } |
3121 | 3121 |
@@ -3125,7 +3125,7 @@ void CMergeDoc::OnBnClickedHexView() | ||
3125 | 3125 | for (int pane = 0; pane < m_nBuffers; pane++) |
3126 | 3126 | bRO[pane] = m_ptBuf[pane]->GetReadOnly(); |
3127 | 3127 | 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); | |
3129 | 3129 | GetMainFrame()->ShowHexMergeDoc(m_pDirDoc, m_filePaths, bRO); |
3130 | 3130 | GetParentFrame()->ShowWindow(SW_RESTORE); |
3131 | 3131 | GetParentFrame()->DestroyWindow(); |
@@ -3133,7 +3133,7 @@ void CMergeDoc::OnBnClickedHexView() | ||
3133 | 3133 | |
3134 | 3134 | void CMergeDoc::OnOK() |
3135 | 3135 | { |
3136 | - m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar, FALSE, FALSE); | |
3136 | + m_pView[0]->GetParentFrame()->ShowControlBar(m_pEncodingErrorBar.get(), FALSE, FALSE); | |
3137 | 3137 | } |
3138 | 3138 | |
3139 | 3139 | void CMergeDoc::OnFileRecompareAsXML() |
@@ -321,7 +321,7 @@ protected: | ||
321 | 321 | TempFile m_tempFiles[3]; /**< Temp files for compared files */ |
322 | 322 | int m_nDiffContext; |
323 | 323 | bool m_bMixedEol; /**< Does this document have mixed EOL style? */ |
324 | - CEncodingErrorBar *m_pEncodingErrorBar; | |
324 | + std::unique_ptr<CEncodingErrorBar> m_pEncodingErrorBar; | |
325 | 325 | bool m_bHasSyncPoints; |
326 | 326 | bool m_bAutoMerged; |
327 | 327 | // friend access |