[sword-svn] r164 - trunk/src/SwordReader_GUI

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Fri Aug 1 21:03:58 MST 2008


Author: dtrotzjr
Date: 2008-08-01 21:03:58 -0700 (Fri, 01 Aug 2008)
New Revision: 164

Modified:
   trunk/src/SwordReader_GUI/SRMainFrame.cpp
   trunk/src/SwordReader_GUI/SRMainFrame.h
   trunk/src/SwordReader_GUI/SRModuleView.cpp
Log:
Fixed all remaining memory and resource leaks in the SwordReader_GUI source code. 

Modified: trunk/src/SwordReader_GUI/SRMainFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.cpp	2008-08-02 01:25:08 UTC (rev 163)
+++ trunk/src/SwordReader_GUI/SRMainFrame.cpp	2008-08-02 04:03:58 UTC (rev 164)
@@ -56,14 +56,12 @@
     m_wcsWindowName = "SwordReader";
     m_hInstance = SRFramework::SRApp::GetInstanceHandle();
    
-    m_swmgr = new SWMgr((m_pMarkupFilterMgr = new MarkupFilterMgr(sword::FMT_HTMLHREF, sword::ENC_UTF16)));
+    m_swmgr = new SWMgr(new MarkupFilterMgr(sword::FMT_HTMLHREF, sword::ENC_UTF16));
 
 }
 
 SRMainFrame::~SRMainFrame()
 {
-    if(m_pMarkupFilterMgr)
-        delete m_pMarkupFilterMgr;
     if(m_swmgr)
         delete m_swmgr;
     if(m_bufModOptions)

Modified: trunk/src/SwordReader_GUI/SRMainFrame.h
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.h	2008-08-02 01:25:08 UTC (rev 163)
+++ trunk/src/SwordReader_GUI/SRMainFrame.h	2008-08-02 04:03:58 UTC (rev 164)
@@ -57,7 +57,6 @@
     // For now we only have one.
     INT          m_nCurrentModule;
     SRModuleView *m_viewModules[SR_MAX_MODULE_PAGES];
-    MarkupFilterMgr *m_pMarkupFilterMgr;
 	SWMgr        *m_swmgr;
     ModuleMap    *m_modTexts;
     SWModule     *m_modGreekLex;

Modified: trunk/src/SwordReader_GUI/SRModuleView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRModuleView.cpp	2008-08-02 01:25:08 UTC (rev 163)
+++ trunk/src/SwordReader_GUI/SRModuleView.cpp	2008-08-02 04:03:58 UTC (rev 164)
@@ -112,8 +112,6 @@
         rc = WaitForSingleObject(m_hLoadTextThread, INFINITE);
         if(rc != WAIT_OBJECT_0)
             return; // Need to deal with this in a better manner.
-        CloseHandle(m_hLoadTextThread);
-        m_hLoadTextThread = NULL;
     }
     if(!fInThread && !m_fChapterChanged) // This text should still be valid...
         return;
@@ -212,7 +210,7 @@
     oldBrush = SelectObject(hdc, GetStockObject(LTGRAY_BRUSH));
     Rectangle(hdc, r.left, r.top, r.right, r.bottom);
     // Draw the progress bar...
-    r.right = (r.right - r.left) * (fpPercent/100.0f);
+    r.right = (LONG)((r.right - r.left) * (fpPercent/100.0f));
     SelectObject(hdc, GetStockObject(HOLLOW_BRUSH));
     FillRect(hdc, &r, brushPBAR);
     Rectangle(hdc, r.left, r.top, r.right, r.bottom);
@@ -240,6 +238,8 @@
 
 VOID SRModuleView::CreateLoadTextThread()
 {
+    if(m_hLoadTextThread)
+        CloseHandle(m_hLoadTextThread);
     m_hLoadTextThread = CreateThread(NULL, 0, LoadTextThread, (LPVOID) this, 0, &m_dwLoadTextThreadID);
 }
 




More information about the sword-cvs mailing list