Fix event emitter invalid memory references (#6331)
Fix event emitter invalid memory references (#6331)

While an event is processed new events can be added to the queue.
If this happens and the `m_queue` capacity is reached the container is resized and references point to an invalid memory address.

The PR makes a local copy of the event so that event handlers are always have a valid reference during execution.
dresden-elektronik/deconz-rest-plugin,dresden-elektronik/deconz-rest-plugin,dresden-elektronik/deconz-rest-plugin,dresden-elektronik/deconz-rest-plugin,dresden-elektronik/deconz-rest-plugin