protect access to gRootModule with a weak ref


git-svn-id: https://root.cern.ch/svn/root/branches/v5-34-00-patches@48726 27541ba8-7e3a-0410-8455-c3a389f83636
remove unused variable


git-svn-id: https://root.cern.ch/svn/root/branches/v5-34-00-patches@48727 27541ba8-7e3a-0410-8455-c3a389f83636