core/outputconfiguration: use std::weak_ptr for storing the mode
Otherwise an unplugged output can cause use-after-free problems on OutputChangeSet destruction
(cherry picked from commit 2a6e3b7a)
Otherwise an unplugged output can cause use-after-free problems on OutputChangeSet destruction
(cherry picked from commit 2a6e3b7a)