[glom] Document::get_lookup_fields(): Prevent endless self lookups.



commit 5cbf3d1a72edf15260596e8915f374b269fa8590
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Sep 7 16:00:02 2015 +0200

    Document::get_lookup_fields(): Prevent endless self lookups.
    
    For instance, if a field uses a lookup (to set data into itself)
    whose relationship uses that field itself as the from field. That
    would cause the lookup to trigger the lookup again, endlessly.
    Bug #754641 (m.rick.mac)

 glom/libglom/document/document.cc |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/glom/libglom/document/document.cc b/glom/libglom/document/document.cc
index f85abbc..b82d622 100644
--- a/glom/libglom/document/document.cc
+++ b/glom/libglom/document/document.cc
@@ -5109,6 +5109,14 @@ Document::type_list_lookups Document::get_lookup_fields(const Glib::ustring& tab
     //Examine each field that looks up its data from a relationship:
     if(field && field->get_is_lookup())
     {
+      //Don't let a field trigger its own value.
+      //(for instance, if a field uses a lookup whose relationship uses that
+      //field itself as the from field.)
+      if(field->get_name() == field_name)
+      {
+        continue;
+      }
+
       //Get the relationship information:
       auto relationship = field->get_lookup_relationship();
       if(relationship)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]