aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2005-07-17 20:30:49 +0000
committerVincent Richard <[email protected]>2005-07-17 20:30:49 +0000
commit66ad33c37b1d378bba40e02ede2d8d6810f5b580 (patch)
treea9a31e04d35e3c2c3ec25a67a18218bad170a62f /examples
parentAdded unit tests for smart pointer. (diff)
downloadvmime-66ad33c37b1d378bba40e02ede2d8d6810f5b580.tar.gz
vmime-66ad33c37b1d378bba40e02ede2d8d6810f5b580.zip
Reference counting and smart pointers.
Diffstat (limited to 'examples')
-rw-r--r--examples/viewer/viewer.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/viewer/viewer.cpp b/examples/viewer/viewer.cpp
index 2f80b33c..64076af7 100644
--- a/examples/viewer/viewer.cpp
+++ b/examples/viewer/viewer.cpp
@@ -44,18 +44,18 @@ GtkWidget* textArea = NULL;
GtkTreeStore* treeModel = NULL;
-vmime::message* currentMessage = NULL;
+vmime::ref <vmime::message> currentMessage = NULL;
-void insertRowInModel(GtkTreeStore* model, const vmime::component* comp, GtkTreeIter* parent = NULL)
+void insertRowInModel(GtkTreeStore* model, vmime::ref <const vmime::component> comp, GtkTreeIter* parent = NULL)
{
GtkTreeIter iter;
gtk_tree_store_append(model, &iter, parent);
- gtk_tree_store_set(model, &iter, 0, typeid(*comp).name(), 1, comp, -1);
+ gtk_tree_store_set(model, &iter, 0, typeid(*comp).name(), 1, comp.get(), -1);
- const std::vector <const vmime::component*> children = comp->getChildComponents();
+ const std::vector <vmime::ref <const vmime::component> > children = comp->getChildComponents();
for (int i = 0 ; i < children.size() ; ++i)
{
@@ -134,10 +134,9 @@ void openFile(const std::string& filename)
}
while (file.gcount());
- vmime::message* msg = new vmime::message();
+ vmime::ref <vmime::message> msg = vmime::create <vmime::message>();
msg->parse(data);
- delete (currentMessage);
currentMessage = msg;
char* convData = g_convert_with_fallback(data.c_str(), data.length(),