Enable context menu for asset items in headless mode + fix a memory leak.