This happens when just clicking on the close button in KWin's window decoration while the context menu is open. Maybe this backtrace better demonstrates what's going on:
The cyan parts are REAPER's event loop. The green part is a plugin's IRunLoop:
nFDIsSet() handler that REAPER calls when something has been written to the plugin's socket (when the wants to do something from REAPER's GUI thread). From that event handler the plugin calls REAPER's IContextMenu:
opup() implementation. There's no symbol for that, but that's frame #20. At that point REAPER's GUI event loop takes over to handle the context menu. Then when you try to close the X11 window while all of this is going on, REAPER tries to call IPlugView::removed() in the topmost cyan part followed by IPlugView::release(), which ends up deallocating the IPlugView implementation. This is the yellow part at top of the call stack. Since the IRunLoop implementation and IPlugView implementation are canonically implemented by the same object, this will cause some very fun undefined behavior unless the plugin is specifically designed to work around this.