Revision: 32531
          http://brlcad.svn.sourceforge.net/brlcad/?rev=32531&view=rev
Author:   d_rossberg
Date:     2008-08-25 14:28:48 +0000 (Mon, 25 Aug 2008)

Log Message:
-----------
handle possible exceptions and return values coming from the callback objects

Modified Paths:
--------------
    rt^3/trunk/src/coreInterface/ConstDatabase.cpp

Modified: rt^3/trunk/src/coreInterface/ConstDatabase.cpp
===================================================================
--- rt^3/trunk/src/coreInterface/ConstDatabase.cpp      2008-08-25 14:18:59 UTC 
(rev 32530)
+++ rt^3/trunk/src/coreInterface/ConstDatabase.cpp      2008-08-25 14:28:48 UTC 
(rev 32531)
@@ -111,10 +111,21 @@
         {
             db_update_nref(m_rtip->rti_dbip, m_resp);
 
-               for (size_t i = 0; i < RT_DBNHASH; i++)
-                       for (directory* pDir = m_rtip->rti_dbip->dbi_Head[i]; 
pDir != DIR_NULL; pDir = pDir->d_forw)
-                               if (pDir->d_nref == 0)
-                        callback(pDir->d_namep);
+            for (size_t i = 0; i < RT_DBNHASH; i++)
+                for (directory* pDir = m_rtip->rti_dbip->dbi_Head[i]; pDir != 
DIR_NULL; pDir = pDir->d_forw)
+                    if (pDir->d_nref == 0) {
+                        try {
+                            if (!callback(pDir->d_namep)) {
+                                i = RT_DBNHASH - 1;
+                                break;
+                            }
+                        }
+                        catch(...) {
+                            BU_UNSETJUMP;
+
+                            throw;
+                        }
+                    }
         }
 
 END_MARK:
@@ -264,7 +275,18 @@
 
                                     if (actualCount <= nodeCount) {
                                         for (int i = 0; i < actualCount; i++) {
-                                            
callback(pRtTreeArray[i].tl_tree->tr_l.tl_name);
+                                            try {
+                                                if 
(!callback(pRtTreeArray[i].tl_tree->tr_l.tl_name))
+                                                    break;
+                                            }
+                                            catch(...) {
+                                                
db_free_tree(pRtTreeArray[i].tl_tree, m_resp);
+                                                bu_free(pRtTreeArray, "tree 
list");
+                                                rt_db_free_internal(&intern, 
m_resp);
+                                                BU_UNSETJUMP;
+
+                                                throw;
+                                            }
                                             
db_free_tree(pRtTreeArray[i].tl_tree, m_resp);
                                         }
                                     }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to