Do not store getenv() pointers in static variables.

... or the pointer might be invalidated if the environments
changes.  Fixes #63.

* src/taalgos/dotty.cc, src/tgbaalgos/dotty.cc,
src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc:
Copy the environment in strings instead.
* wrap/python/tests/automata.ipynb: Adjust comment.
This commit is contained in:
Alexandre Duret-Lutz 2015-03-20 19:07:02 +01:00
parent 519f5e3cee
commit 125fa983ab
5 changed files with 71 additions and 31 deletions

View file

@ -1,7 +1,7 @@
{
"metadata": {
"name": "",
"signature": "sha256:9b116e5c61ed241183bd5fb9cd5e35010cceb5043c2fab2be81473f829bc528e"
"signature": "sha256:c0ee6809405cd6426445a43cea6fc3448a99423e1a4be95efeda2fa03680f05f"
},
"nbformat": 3,
"nbformat_minor": 0,
@ -13,10 +13,10 @@
"collapsed": false,
"input": [
"import os\n",
"# Note that Spot (loaded by the kernel) will cache a \n",
"# pointer to the environment variable the first time it\n",
"# reads them. The Kernel may crash if you attempt to\n",
"# modify the variables afterwards. See issue #63.\n",
"# Note that Spot (loaded by the kernel) will store a copy of\n",
"# the environment variable the first time it reads them, so\n",
"# if you change those variables, the new values will be ignored\n",
"# until you restart the kernel.\n",
"os.environ['SPOT_DOTEXTRA'] = 'size=\"11,5\" node[style=filled,fillcolor=\"#ffffaa\"]'\n",
"os.environ['SPOT_DOTDEFAULT'] = 'rbcf(Lato)'\n",
"import spot"
@ -159,7 +159,7 @@
"</svg>\n"
],
"text": [
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7f17fc124150> >"
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7fa0e8162150> >"
]
}
],
@ -291,7 +291,7 @@
"</svg>"
],
"text": [
"<IPython.core.display.SVG at 0x7f17fff640f0>"
"<IPython.core.display.SVG at 0x7fa0ead4a4e0>"
]
}
],
@ -437,7 +437,7 @@
"</svg>"
],
"text": [
"<IPython.core.display.SVG at 0x7f17fc047f60>"
"<IPython.core.display.SVG at 0x7fa0e8083eb8>"
]
}
],
@ -530,7 +530,7 @@
"</svg>\n"
],
"text": [
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7f17fc0fb930> >"
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7fa0e8138930> >"
]
}
],
@ -600,7 +600,7 @@
"</svg>\n"
],
"text": [
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7f17fc0fbb70> >"
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7fa0e8138b70> >"
]
}
],
@ -669,7 +669,7 @@
"</svg>\n"
],
"text": [
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7f17fc0fb990> >"
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7fa0e81389c0> >"
]
}
],
@ -785,7 +785,7 @@
"</svg>"
],
"text": [
"<IPython.core.display.SVG at 0x7f17ed8c7b38>"
"<IPython.core.display.SVG at 0x7fa0e803ab70>"
]
}
],
@ -975,7 +975,7 @@
"</svg>"
],
"text": [
"<IPython.core.display.SVG at 0x7f17ed8c7a58>"
"<IPython.core.display.SVG at 0x7fa0e803ac88>"
]
}
],
@ -1068,7 +1068,7 @@
"</svg>\n"
],
"text": [
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7f17fc0fbb40> >"
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7fa0e81389f0> >"
]
}
],
@ -1086,7 +1086,7 @@
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 15,
"prompt_number": 13,
"svg": [
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n",
"<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\n",
@ -1542,11 +1542,11 @@
"</svg>\n"
],
"text": [
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7f17fc0fb9c0> >"
"<spot_impl.tgba_digraph; proxy of <Swig Object of type 'std::shared_ptr< spot::tgba_digraph > *' at 0x7fa0e8138b40> >"
]
}
],
"prompt_number": 15
"prompt_number": 13
}
],
"metadata": {}