Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1106

atomicOpsMutex causes static initialization problems

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Resolution: Fixed
    • 2.4.0
    • 2.5.0
    • Utilities
    • None
    • Operating System: Linux
      Platform: PC
    • 25817

    Description

      In my application, I use alternate implementations of ::new and its ilk. Up to
      version 2.3 this provided to be a non-issue because Xerces didn't allocate any
      memory until after XMLPLatformUtils::Initialize was called. Starting with
      version 2.4, the constructor of XMLMutex seems to allocate memory and this class
      is used by LinuxPlatformUtils in a static instance (atomicOpsMutex). This means
      that users of Xerces can no longer determine when Xerces will allocate its first
      memory (since the order of static initialization is "unspecified").

      Consequently, I find it necessary to modify the code in
      util/Platforms/Linux/LinuxPlatformUtils.cpp to change atomicOpsMutex to be a
      pointer that is allocated in LinuxPlatformUtils::platformInit.

      Attachments

        1. ASF.LICENSE.NOT.GRANTED--static_init.cpp
          0.5 kB
          Reid Spencer
        2. ASF.LICENSE.NOT.GRANTED--patch.txt
          3 kB
          Reid Spencer

        Activity

          People

            Unassigned Unassigned
            rspencer@x10sys.com Reid Spencer
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: