From 10b5e5431d004fe51df30140f20346b2c91248fb Mon Sep 17 00:00:00 2001 From: Curtis Dunham Date: Tue, 23 Dec 2014 11:51:40 -0600 Subject: sim: fix reference counting of PythonEvent When gem5 is a slave to another simulator and the Python is only used to initialize the configuration (and not perform actual simulation), a "debug start" (--debug-start) event will get freed during or immediately after the initial Python frame's execution rather than remaining in the event queue. This tricky patch fixes the GC issue causing this. --- src/python/swig/event.i | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/python/swig/event.i') diff --git a/src/python/swig/event.i b/src/python/swig/event.i index 23bb31364..cc72794ed 100644 --- a/src/python/swig/event.i +++ b/src/python/swig/event.i @@ -71,6 +71,10 @@ } } +%typemap(out) PythonEvent* { + result->object = $result = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PythonEvent, SWIG_POINTER_NEW); +} + %ignore EventQueue::schedule; %ignore EventQueue::deschedule; -- cgit v1.2.3