[sword-svn] r100 - trunk/src/gui

dtrotzjr at www.crosswire.org dtrotzjr at www.crosswire.org
Sun Mar 16 20:20:08 MST 2008


Author: dtrotzjr
Date: 2008-03-16 20:20:07 -0700 (Sun, 16 Mar 2008)
New Revision: 100

Modified:
   trunk/src/gui/ApplicationInterface.cpp
   trunk/src/gui/ApplicationInterface.h
   trunk/src/gui/Main.cpp
   trunk/src/gui/NavFind.cpp
   trunk/src/gui/NavFind.h
   trunk/src/gui/NavPage.h
   trunk/src/gui/VerseTextControl.h
   trunk/src/gui/WCString.cpp
Log:
Fixed all known memory leaks.

Modified: trunk/src/gui/ApplicationInterface.cpp
===================================================================
--- trunk/src/gui/ApplicationInterface.cpp	2008-03-16 18:24:37 UTC (rev 99)
+++ trunk/src/gui/ApplicationInterface.cpp	2008-03-17 03:20:07 UTC (rev 100)
@@ -32,6 +32,11 @@
 	background=(HBRUSH) GetStockObject(WHITE_BRUSH);
 }
 
+void closeApplicationInterface() {
+    DeleteObject(textFont);
+    DeleteObject(navFont);
+}
+
 void loadString(UINT id, LPTSTR buffer) {
 	LoadString(g_hInst, id, buffer, MAX_LOADSTRING);
 }

Modified: trunk/src/gui/ApplicationInterface.h
===================================================================
--- trunk/src/gui/ApplicationInterface.h	2008-03-16 18:24:37 UTC (rev 99)
+++ trunk/src/gui/ApplicationInterface.h	2008-03-17 03:20:07 UTC (rev 100)
@@ -48,6 +48,8 @@
 
 void initApplicationInterface();
 
+void closeApplicationInterface();
+
 // load string from string table
 void loadString(UINT id, LPTSTR buffer);
 WCString loadString(UINT id);

Modified: trunk/src/gui/Main.cpp
===================================================================
--- trunk/src/gui/Main.cpp	2008-03-16 18:24:37 UTC (rev 99)
+++ trunk/src/gui/Main.cpp	2008-03-17 03:20:07 UTC (rev 100)
@@ -233,6 +233,7 @@
 			PostQuitMessage(0);
 			g_swordConf->Save();
 			delete g_swordConf;
+            closeApplicationInterface();
 			break;
 		case WM_ACTIVATE:
 	        // Notify shell of our activate message

Modified: trunk/src/gui/NavFind.cpp
===================================================================
--- trunk/src/gui/NavFind.cpp	2008-03-16 18:24:37 UTC (rev 99)
+++ trunk/src/gui/NavFind.cpp	2008-03-17 03:20:07 UTC (rev 100)
@@ -252,6 +252,7 @@
 	verses.push_back(*verse);
 	WCString verseString = SwordIndex::verseToString(verse);
 	SendMessage (results, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)verseString.w_str());
+    delete verse;
 }
 
 void NavFind::searchFor(const WCString &query) {

Modified: trunk/src/gui/NavFind.h
===================================================================
--- trunk/src/gui/NavFind.h	2008-03-16 18:24:37 UTC (rev 99)
+++ trunk/src/gui/NavFind.h	2008-03-17 03:20:07 UTC (rev 100)
@@ -15,14 +15,14 @@
 class NavFind: public NavPage, public Searcher {
 public:
 	NavFind(SimpleNavigator* navigator);
-	~NavFind();
+	virtual ~NavFind();
 	void show();
 	void paint();
 	void hide();
 	void buttonClicked(int id);
 	void searchFor(const WCString &query);
 	virtual void setProgress(int percent);
-	virtual void addResult(const WCString &verse);
+	virtual void addResult(const WCString &verseStr);
 	void placeWidgets();
 private:
 	//Navigator* navigator;

Modified: trunk/src/gui/NavPage.h
===================================================================
--- trunk/src/gui/NavPage.h	2008-03-16 18:24:37 UTC (rev 99)
+++ trunk/src/gui/NavPage.h	2008-03-17 03:20:07 UTC (rev 100)
@@ -34,7 +34,7 @@
 		this->navigator=navigator;
 	};
 	//	Destructor
-	~NavPage() {};
+	virtual ~NavPage() {};
 	//	In the derived class, show all visual components here using 
 	//	ShowWindow. For example:
 	//

Modified: trunk/src/gui/VerseTextControl.h
===================================================================
--- trunk/src/gui/VerseTextControl.h	2008-03-16 18:24:37 UTC (rev 99)
+++ trunk/src/gui/VerseTextControl.h	2008-03-17 03:20:07 UTC (rev 100)
@@ -10,6 +10,7 @@
 class VerseTextControl: public TextControl {
 public:
 	VerseTextControl(int x, int y, int width, int height);
+    ~VerseTextControl() {}
 	void addAnchoredText(const WCString &text, int anchor); 
 	// we are able to scroll back to this point using the anchor
 	void gotoAnchor(int anchor);

Modified: trunk/src/gui/WCString.cpp
===================================================================
--- trunk/src/gui/WCString.cpp	2008-03-16 18:24:37 UTC (rev 99)
+++ trunk/src/gui/WCString.cpp	2008-03-17 03:20:07 UTC (rev 100)
@@ -3,6 +3,7 @@
 
 WCString::WCString(void)
 : char_copy(NULL)
+, data(L" ")
 {
 
 }




More information about the sword-cvs mailing list