Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/44387 )

Change subject: python: Don't try setting the parent of null SimObject pointers.
......................................................................

python: Don't try setting the parent of null SimObject pointers.

The line of code which would have added the null SimObject as a child
was already guarded by an if, but the line before it which would set the
parent of the null SimObject itself was not. This change moves it into
the if as well.

Change-Id: Icfbc0e87e0ab55917735f720de4e94c19185df46
---
M src/python/m5/SimObject.py
1 file changed, 1 insertion(+), 1 deletion(-)



diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 8552939..766b722 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -1487,8 +1487,8 @@
             # exposed by a buggy script. Changes here will probably not be
             # exercised without specialized testing.
             self.clear_child(name)
-        child.set_parent(self, name)
         if not isNullPointer(child):
+            child.set_parent(self, name)
             self._children[name] = child

     # Take SimObject-valued parameters that haven't been explicitly

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44387
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Icfbc0e87e0ab55917735f720de4e94c19185df46
Gerrit-Change-Number: 44387
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to