[xsd-users] Assignment of optional boolean attribute does not survive on the heap; possibly a bug?

Andreas.Hackeloeer at bmw.de Andreas.Hackeloeer at bmw.de
Wed Jun 26 08:26:42 EDT 2013


Hi Boris and Erik,

thank you very much for your help!

I now tried the following:

Method A:

myMap.selectedSourceMap().set(true);

Method B later called by method A:

if (myMap.selectedSourceMap().present() && myMap.selectedSourceMap().get())
{
  // This is never reached
}

Unfortunately, it still does not work. It looks like the Present flag is set to false as soon as the scope of the method is left.

The debugger tells me that immediately after the set() method is called, the following holds:

myMap.SelectedSourceMap_.present_ == true
myMap.SelectedSourceMap_.x_ == true

After this method has called a new method which uses the shared_ptr<Configuration> class member reference to the xml mapping and re-iterates the map element, the following holds:

myMap.SelectedSourceMap_.present_ == false
myMap.SelectedSourceMap_.x_ == true

It looks like the boolean value is "forgotten" after leaving the stack while the string value (Title attribute) survives.

Regards,
Andreas



More information about the xsd-users mailing list