[sword-svn] r163 - in trunk/src: . SwordReader_GUI
dtrotzjr at www.crosswire.org
dtrotzjr at www.crosswire.org
Fri Aug 1 18:25:09 MST 2008
Author: dtrotzjr
Date: 2008-08-01 18:25:08 -0700 (Fri, 01 Aug 2008)
New Revision: 163
Modified:
trunk/src/SwRd.sln
trunk/src/SwordReader_GUI/Main.cpp
trunk/src/SwordReader_GUI/SRMainFrame.cpp
trunk/src/SwordReader_GUI/SRMainFrame.h
trunk/src/SwordReader_GUI/SRModuleView.cpp
trunk/src/SwordReader_GUI/SRReaderApp.cpp
trunk/src/SwordReader_GUI/SRTextView.cpp
trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
Log:
Fixed several memory leaks as reported by Entrek CodeSnitch.
Modified: trunk/src/SwRd.sln
===================================================================
--- trunk/src/SwRd.sln 2008-08-01 05:39:31 UTC (rev 162)
+++ trunk/src/SwRd.sln 2008-08-02 01:25:08 UTC (rev 163)
@@ -30,42 +30,64 @@
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4)
Debug|Windows Mobile 6 Professional SDK (ARMV4I) PPC = Debug|Windows Mobile 6 Professional SDK (ARMV4I) PPC
Debug|Windows Mobile 6 Standard SDK (ARMV4I) SP = Debug|Windows Mobile 6 Standard SDK (ARMV4I) SP
+ Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4)
Release|Windows Mobile 6 Professional SDK (ARMV4I) PPC = Release|Windows Mobile 6 Professional SDK (ARMV4I) PPC
Release|Windows Mobile 6 Standard SDK (ARMV4I) SP = Release|Windows Mobile 6 Standard SDK (ARMV4I) SP
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
+ {D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
+ {D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Debug|Windows Mobile 6 Professional SDK (ARMV4I) PPC.ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Debug|Windows Mobile 6 Professional SDK (ARMV4I) PPC.Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Debug|Windows Mobile 6 Professional SDK (ARMV4I) PPC.Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Debug|Windows Mobile 6 Standard SDK (ARMV4I) SP.ActiveCfg = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Debug|Windows Mobile 6 Standard SDK (ARMV4I) SP.Build.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Debug|Windows Mobile 6 Standard SDK (ARMV4I) SP.Deploy.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
+ {D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
+ {D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
+ {D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Release|Windows Mobile 6 Professional SDK (ARMV4I) PPC.ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Release|Windows Mobile 6 Professional SDK (ARMV4I) PPC.Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Release|Windows Mobile 6 Professional SDK (ARMV4I) PPC.Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Release|Windows Mobile 6 Standard SDK (ARMV4I) SP.ActiveCfg = Release|Windows Mobile 6 Standard SDK (ARMV4I)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Release|Windows Mobile 6 Standard SDK (ARMV4I) SP.Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
{D6A4997A-793C-4A4C-B27F-0DAD8FCCC3E5}.Release|Windows Mobile 6 Standard SDK (ARMV4I) SP.Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
+ {697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
+ {697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
+ {697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Debug|Windows Mobile 6 Professional SDK (ARMV4I) PPC.ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Debug|Windows Mobile 6 Professional SDK (ARMV4I) PPC.Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Debug|Windows Mobile 6 Professional SDK (ARMV4I) PPC.Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Debug|Windows Mobile 6 Standard SDK (ARMV4I) SP.ActiveCfg = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Debug|Windows Mobile 6 Standard SDK (ARMV4I) SP.Build.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Debug|Windows Mobile 6 Standard SDK (ARMV4I) SP.Deploy.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I)
+ {697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
+ {697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
+ {697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Release|Windows Mobile 6 Professional SDK (ARMV4I) PPC.ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Release|Windows Mobile 6 Professional SDK (ARMV4I) PPC.Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Release|Windows Mobile 6 Professional SDK (ARMV4I) PPC.Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Release|Windows Mobile 6 Standard SDK (ARMV4I) SP.ActiveCfg = Release|Windows Mobile 6 Standard SDK (ARMV4I)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Release|Windows Mobile 6 Standard SDK (ARMV4I) SP.Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
{697017EE-0728-4DD1-AFBB-ABDA11CE86D5}.Release|Windows Mobile 6 Standard SDK (ARMV4I) SP.Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I)
+ {DDE677D8-104D-4F48-997C-A4D6FBC6F3D1}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug
+ {DDE677D8-104D-4F48-997C-A4D6FBC6F3D1}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug
{DDE677D8-104D-4F48-997C-A4D6FBC6F3D1}.Debug|Windows Mobile 6 Professional SDK (ARMV4I) PPC.ActiveCfg = Debug
{DDE677D8-104D-4F48-997C-A4D6FBC6F3D1}.Debug|Windows Mobile 6 Standard SDK (ARMV4I) SP.ActiveCfg = Debug
+ {DDE677D8-104D-4F48-997C-A4D6FBC6F3D1}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release
+ {DDE677D8-104D-4F48-997C-A4D6FBC6F3D1}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release
{DDE677D8-104D-4F48-997C-A4D6FBC6F3D1}.Release|Windows Mobile 6 Professional SDK (ARMV4I) PPC.ActiveCfg = Release
{DDE677D8-104D-4F48-997C-A4D6FBC6F3D1}.Release|Windows Mobile 6 Standard SDK (ARMV4I) SP.ActiveCfg = Release
+ {0F95E947-2E35-4483-89E8-44A970DB32CC}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug
+ {0F95E947-2E35-4483-89E8-44A970DB32CC}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug
{0F95E947-2E35-4483-89E8-44A970DB32CC}.Debug|Windows Mobile 6 Professional SDK (ARMV4I) PPC.ActiveCfg = Debug
{0F95E947-2E35-4483-89E8-44A970DB32CC}.Debug|Windows Mobile 6 Standard SDK (ARMV4I) SP.ActiveCfg = Debug
+ {0F95E947-2E35-4483-89E8-44A970DB32CC}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release
+ {0F95E947-2E35-4483-89E8-44A970DB32CC}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release
{0F95E947-2E35-4483-89E8-44A970DB32CC}.Release|Windows Mobile 6 Professional SDK (ARMV4I) PPC.ActiveCfg = Release
{0F95E947-2E35-4483-89E8-44A970DB32CC}.Release|Windows Mobile 6 Standard SDK (ARMV4I) SP.ActiveCfg = Release
EndGlobalSection
Modified: trunk/src/SwordReader_GUI/Main.cpp
===================================================================
--- trunk/src/SwordReader_GUI/Main.cpp 2008-08-01 05:39:31 UTC (rev 162)
+++ trunk/src/SwordReader_GUI/Main.cpp 2008-08-02 01:25:08 UTC (rev 163)
@@ -9,15 +9,15 @@
LPTSTR lpCmdLine,
int nCmdShow)
{
- SRReaderApp *app = new SRReaderApp(hInstance);
+ SRReaderApp app(hInstance);
HCURSOR hOldCursor = SetCursor(LoadCursor(NULL, IDC_WAIT));
- if (!app->InitApp(nCmdShow))
+ if (!app.InitApp(nCmdShow))
return FALSE; // Either it failed, or it's already loaded...
SetCursor(hOldCursor);
- app->RefreshWindows();
+ app.RefreshWindows();
- return app->Run();
+ return app.Run();
}
Modified: trunk/src/SwordReader_GUI/SRMainFrame.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.cpp 2008-08-01 05:39:31 UTC (rev 162)
+++ trunk/src/SwordReader_GUI/SRMainFrame.cpp 2008-08-02 01:25:08 UTC (rev 163)
@@ -1,5 +1,4 @@
#include "SRMainFrame.h"
-#include <markupfiltmgr.h>
#include <swordce.h>
using namespace sword;
@@ -50,18 +49,21 @@
const char *cwd = getWorkingDirectory();
char confFName[MAX_PATH];
_snprintf(confFName, MAX_PATH, "%s\\options.conf", cwd);
- m_confOptions = new SWConfig(confFName);
+ m_confOptions = new SWConfig(confFName);
m_confOptions->Load();
m_wcsClassName = "SRMainFrame";
m_wcsWindowName = "SwordReader";
m_hInstance = SRFramework::SRApp::GetInstanceHandle();
- m_swmgr = new SWMgr(new sword::MarkupFilterMgr(sword::FMT_HTMLHREF, sword::ENC_UTF16));
+
+ m_swmgr = new SWMgr((m_pMarkupFilterMgr = 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)
@@ -76,6 +78,12 @@
delete m_viewFind;
if(m_viewModules[m_nCurrentModule])
delete m_viewModules[m_nCurrentModule];
+ if(m_confOptions)
+ delete m_confOptions;
+ if(m_modTexts)
+ delete m_modTexts;
+ if(m_menuBar)
+ delete m_menuBar;
}
BOOL SRMainFrame::Register()
@@ -260,7 +268,7 @@
case MENU_SHUTDOWN:
::SendMessage(m_hWnd, WM_ACTIVATE, MAKEWPARAM(WA_INACTIVE, 0), (LPARAM)m_hWnd);
::SendMessage (m_hWnd, WM_CLOSE, 0, 0);
- exit(0);
+ ::PostQuitMessage(0);
case MENU_TEXT:
m_viewModules[m_nCurrentModule]->Show();
m_viewBook->Hide();
Modified: trunk/src/SwordReader_GUI/SRMainFrame.h
===================================================================
--- trunk/src/SwordReader_GUI/SRMainFrame.h 2008-08-01 05:39:31 UTC (rev 162)
+++ trunk/src/SwordReader_GUI/SRMainFrame.h 2008-08-02 01:25:08 UTC (rev 163)
@@ -2,6 +2,7 @@
#include <swmgr.h>
#include <swmodule.h>
#include <versekey.h>
+#include <markupfiltmgr.h>
#include "resource.h"
#include "SwordReaderResource.h"
#include "SRFramework/SRFrame.h"
@@ -56,6 +57,7 @@
// 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-01 05:39:31 UTC (rev 162)
+++ trunk/src/SwordReader_GUI/SRModuleView.cpp 2008-08-02 01:25:08 UTC (rev 163)
@@ -33,6 +33,8 @@
SRModuleView::~SRModuleView(void)
{
+ if(m_hLoadTextThread)
+ CloseHandle(m_hLoadTextThread);
}
VOID SRModuleView::SetModule(SWModule *pModule)
@@ -109,7 +111,9 @@
m_fAbortThread = TRUE;
rc = WaitForSingleObject(m_hLoadTextThread, INFINITE);
if(rc != WAIT_OBJECT_0)
- return;
+ 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;
@@ -228,6 +232,8 @@
SetTextColor(hdc, oldColor);
SelectObject(hdc, oldBrush);
DeleteObject(font);
+ DeleteObject(brushBG);
+ DeleteObject(brushPBAR);
ReleaseDC(m_hWnd, hdc);
}
Modified: trunk/src/SwordReader_GUI/SRReaderApp.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRReaderApp.cpp 2008-08-01 05:39:31 UTC (rev 162)
+++ trunk/src/SwordReader_GUI/SRReaderApp.cpp 2008-08-02 01:25:08 UTC (rev 163)
@@ -12,6 +12,8 @@
SRReaderApp::~SRReaderApp()
{
+ if(m_pMainFrame)
+ delete m_pMainFrame;
}
WPARAM SRReaderApp::Run()
Modified: trunk/src/SwordReader_GUI/SRTextView.cpp
===================================================================
--- trunk/src/SwordReader_GUI/SRTextView.cpp 2008-08-01 05:39:31 UTC (rev 162)
+++ trunk/src/SwordReader_GUI/SRTextView.cpp 2008-08-02 01:25:08 UTC (rev 163)
@@ -71,9 +71,12 @@
// TODO Detect compiler and determine if we can use CLEARTYPE_QUALITY
m_lfCurFont.lfQuality = ANTIALIASED_QUALITY/*CLEARTYPE_QUALITY*/;
lstrcpy(m_lfCurFont.lfFaceName, _T("Veranda"));
+ try{
+ m_lpszBuff = new TCHAR[m_dwBuffSize];
+ }catch(char * str){
+ printf(str);
+ }
- m_lpszBuff = new TCHAR[m_dwBuffSize];
-
for(DWORD i = 0; i < BTEXT_FONT_CACHE_MAX; i++)
m_hFontCache[i] = 0;
}
@@ -321,10 +324,18 @@
if(!dwMask){
// Found a <font... element
if(!rsState.m_lpftFontTagTail){
- rsState.m_lpftFontTagHead = new SRFontTagItem();
+ try{
+ rsState.m_lpftFontTagHead = new SRFontTagItem();
+ }catch(char * str){
+ printf(str);
+ }
rsState.m_lpftFontTagTail = rsState.m_lpftFontTagHead;
}else{
- rsState.m_lpftFontTagTail->m_lpftNext = new SRFontTagItem();
+ try{
+ rsState.m_lpftFontTagTail->m_lpftNext = new SRFontTagItem();
+ }catch(char * str){
+ printf(str);
+ }
rsState.m_lpftFontTagTail = rsState.m_lpftFontTagTail->m_lpftNext;
}
dwSubIndex += dwWordIndex + 4;
@@ -962,18 +973,28 @@
DWORD i = 0;
INT tag_pairs = 0;
DWORD dwOldEnd = m_dwBuffEnd;
+ TCHAR *lpszTmp = NULL;
if(m_dwBuffEnd != 0 && m_fPreRendered) // not a new buffer...
m_fAppended = TRUE;
if(!m_dwBuffSize){
m_dwBuffSize = BTEXT_BUFF_INC > dwSize ? BTEXT_BUFF_INC : dwSize;
- m_lpszBuff = new TCHAR[m_dwBuffSize];
+ try{
+ m_lpszBuff = new TCHAR[m_dwBuffSize];
+ }catch(char * str){
+ printf(str);
+ }
}
// Do we need to make room for the new szText
if((m_dwBuffEnd + dwSize) > m_dwBuffSize){
DWORD dwNewSize = m_dwBuffSize + (BTEXT_BUFF_INC > dwSize ? BTEXT_BUFF_INC : dwSize);
- TCHAR *lpszTmp = new TCHAR[dwNewSize];
+ try{
+ lpszTmp = new TCHAR[dwNewSize];
+ }catch(char * str){
+ printf(str);
+ }
+
for(i = 0; i < m_dwBuffSize; i++){
lpszTmp[i] = m_lpszBuff[i];
}
@@ -1085,7 +1106,13 @@
if(m_fOwner && m_lpszWord){
delete [] m_lpszWord;
}
- m_lpszWord = new TCHAR[dwWordLen + 1];
+
+ try{
+ m_lpszWord = new TCHAR[dwWordLen + 1];
+ }catch(char * str){
+ printf(str);
+ }
+
for(DWORD i = 0; i < dwWordLen; i++)
m_lpszWord[i] = lpszWord[i];
@@ -1109,7 +1136,11 @@
m_wVerseNum = rhs.m_wVerseNum;
if(m_fOwner && rhs.m_lpszWord){
- m_lpszWord = new TCHAR[m_dwWordLen + 1];
+ try{
+ m_lpszWord = new TCHAR[m_dwWordLen + 1];
+ }catch(char * str){
+ printf(str);
+ }
for(DWORD i = 0; i < m_dwWordLen; i++)
m_lpszWord[i] = rhs.m_lpszWord[i];
m_lpszWord[m_dwWordLen] = 0;
@@ -1139,7 +1170,11 @@
m_fOwner = rhs.m_fOwner;
if(m_fOwner && rhs.m_lpszWord){
- m_lpszWord = new TCHAR[m_dwWordLen + 1];
+ try{
+ m_lpszWord = new TCHAR[m_dwWordLen + 1];
+ }catch(char * str){
+ printf(str);
+ }
for(DWORD i = 0; i < m_dwWordLen; i++)
m_lpszWord[i] = rhs.m_lpszWord[i];
m_lpszWord[m_dwWordLen] = 0;
@@ -1169,8 +1204,12 @@
VOID SRTextView::SRTextLines::InitLines(CONST INT nLineH)
{
m_dwLines = BTEXT_LINE_INC;
- m_lpLines = new SRTextWord[m_dwLines];
- m_lppLinesLastWord = new SRTextWord*[m_dwLines];
+ try{
+ m_lpLines = new SRTextWord[m_dwLines];
+ m_lppLinesLastWord = new SRTextWord*[m_dwLines];
+ }catch(char * str){
+ printf(str);
+ }
for(DWORD i = 0; i < m_dwLines; i++)
m_lppLinesLastWord[i] = &m_lpLines[i];
@@ -1181,8 +1220,12 @@
{
m_dwLastLine = rhs.m_dwLastLine;
m_dwLines = rhs.m_dwLines;
- m_lpLines = new SRTextWord[m_dwLines];
- m_lppLinesLastWord = new SRTextWord*[m_dwLines];
+ try{
+ m_lpLines = new SRTextWord[m_dwLines];
+ m_lppLinesLastWord = new SRTextWord*[m_dwLines];
+ }catch(char * str){
+ printf(str);
+ }
for(DWORD i = 0; i < m_dwLines; i++){
m_lpLines[i] = rhs.m_lpLines[i];
@@ -1227,8 +1270,12 @@
m_dwLastLine = rhs.m_dwLastLine;
m_dwLines = rhs.m_dwLines;
- m_lpLines = new SRTextWord[m_dwLines];
- m_lppLinesLastWord = new SRTextWord*[m_dwLines];
+ try{
+ m_lpLines = new SRTextWord[m_dwLines];
+ m_lppLinesLastWord = new SRTextWord*[m_dwLines];
+ }catch(char * str){
+ printf(str);
+ }
for(DWORD i = 0; i < m_dwLines; i++){
m_lpLines[i] = rhs.m_lpLines[i];
@@ -1304,16 +1351,22 @@
{
DWORD dwLines = 0;
DWORD i = 0;
-
+ SRTextWord *pbtTemp1 = NULL;
+ SRTextWord **ppbtTemp2 = NULL;
// Check if we are about to overflow the allocated lines
// If so resize...
if(dwLine >= m_dwLines){
dwLines = m_dwLines + BTEXT_LINE_INC;
//unsigned int nLastLine = m_dwLastLine;
i = 0;
- SRTextWord *pbtTemp1 = new SRTextWord[dwLines];
- SRTextWord **ppbtTemp2 = new SRTextWord*[dwLines];
+ try{
+ pbtTemp1 = new SRTextWord[dwLines];
+ ppbtTemp2 = new SRTextWord*[dwLines];
+ }catch(char * str){
+ printf(str);
+ }
+
for(i = 0; i <= m_dwLastLine; i++){
pbtTemp1[i] = m_lpLines[i];
// Now the next btWord doesn't know it has a new prev btWord
@@ -1336,7 +1389,11 @@
}
SRTextView::SRTextWord *pbtPrevWord = m_lppLinesLastWord[dwLine]->m_lpPrevWord;
*m_lppLinesLastWord[dwLine] = btWord;
- m_lppLinesLastWord[dwLine]->m_lpNextWord = new SRTextWord();
+ try{
+ m_lppLinesLastWord[dwLine]->m_lpNextWord = new SRTextWord();
+ }catch(char * str){
+ printf(str);
+ }
m_lppLinesLastWord[dwLine]->m_lpPrevWord = pbtPrevWord;
// Create the relationship between this btWord and the next
// potential btWord...
Modified: trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj
===================================================================
--- trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj 2008-08-01 05:39:31 UTC (rev 162)
+++ trunk/src/SwordReader_GUI/SwordReader_GUI.vcproj 2008-08-02 01:25:08 UTC (rev 163)
@@ -574,6 +574,7 @@
Name="VCCLCompilerTool"
ExecutionBucket="7"
Optimization="0"
+ FavorSizeOrSpeed="0"
AdditionalIncludeDirectories="..\Dll1\winceSword\include;..\..\..\sword\include"
PreprocessorDefinitions="DEBUG;ARM;_ARM_;UNDER_CE=$(CEVER);_WIN32_WCE=$(CEVER);$(CePlatform);UNICODE;SIMPLE"
RuntimeLibrary="1"
@@ -609,6 +610,7 @@
IgnoreDefaultLibraryNames="$(CENoDefaultLib)"
GenerateDebugInformation="true"
ProgramDatabaseFile="$(PlatformName)\$(ConfigurationName)/SwordReader_GUI.pdb"
+ GenerateMapFile="true"
StackReserveSize="65536"
StackCommitSize="4096"
EntryPointSymbol="WinMainCRTStartup"
More information about the sword-cvs
mailing list