ID 397080 - Collapsed Event Handlers: dictionary changed size during iteration

Follow

Problem summary:

It is somehow possible for the list of collapsed events to be modified at the same time that it is being used. This leads to an exception being raised.

Steps to reproduce:

  • Execute the following snippet of Python code in a Python tab:

em = Utils.EventModuledef handler1(event):    print('Handler1: ', event)    em.QueueEvent('event2', 0)    QtWidgets.QApplication.processEvents()	# Events only get added to self.__collapsedEvents if# there are any handlers registered that consume them.def handler2(event):    passem.RegisterCollapsedHandler(handler1, 'event1', 0)em.RegisterCollapsedHandler(handler2, 'event2', 0)em.QueueEvent('event1', 0)

Expected behaviour:

If events are queued while previous events are being processed, they should be deferred until the next update, instead of raising an exception.

Actual behaviour:

The following exception is printed to the terminal.


[ERROR python.root]: A Runtime[ERROR python.root]: A RuntimeError occurred in "EventModuleUI.py": dictionary changed size during iterationTraceback (most recent call last):File "bin/software_python/Utils/v5/EventModuleUI.py", line 128, in invokeCollapsedHandlers

The user also reported that Katana became unresponsive at the same time.

Workaround:

No known workaround.

Tested versions/platforms:

  • Katana 3.1v2 - Unaffected
  • Katana 3.1v4 - Unaffected
  • Katana 3.1v5 - Affected

Customer version/platform:

Katana 3.1v5 / Linux

    We're sorry to hear that

    Please tell us why