Skip to content

Commit

Permalink
[SystemGlobals] Define static initialization order of CSpecialProtocol
Browse files Browse the repository at this point in the history
The destructor of RarManager uses CSpecialProtocol (a class with only
statics). Therefore we have to make sure that CSpecialProtocol is
destructed after RarManager. The C++ standard guarantees the order of
con/destruction for statics only within the same compilation unit.
  • Loading branch information
fetzerch committed Feb 15, 2016
1 parent 0871790 commit 79fe295
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 4 additions & 0 deletions xbmc/SystemGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include "interfaces/python/XBPython.h"
#endif

// Guarantee that CSpecialProtocol is initialized before and uninitialized after RarManager
#include "filesystem/SpecialProtocol.h"
std::map<std::string, std::string> CSpecialProtocol::m_pathMap;

#if defined(HAS_FILESYSTEM_RAR)
#include "filesystem/RarManager.h"
#endif
Expand Down
2 changes: 0 additions & 2 deletions xbmc/filesystem/SpecialProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
#include "utils/StringUtils.h"
#endif

std::map<std::string, std::string> CSpecialProtocol::m_pathMap;

void CSpecialProtocol::SetProfilePath(const std::string &dir)
{
SetPath("profile", dir);
Expand Down

0 comments on commit 79fe295

Please sign in to comment.