summaryrefslogtreecommitdiff
path: root/cpp/src/slice2py/Main.cpp
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2008-11-18 13:39:14 -0330
committerDwayne Boone <dwayne@zeroc.com>2008-11-18 13:39:14 -0330
commitac8bf31698d259127646a4e114deca1e7d5e334c (patch)
treef694a8fc9e17bbb0044082510e5d0dd5622cbedc /cpp/src/slice2py/Main.cpp
parentRemoved debug statements (diff)
downloadice-ac8bf31698d259127646a4e114deca1e7d5e334c.tar.bz2
ice-ac8bf31698d259127646a4e114deca1e7d5e334c.tar.xz
ice-ac8bf31698d259127646a4e114deca1e7d5e334c.zip
Bug 3541 - Slice signal handling unsafe
Diffstat (limited to 'cpp/src/slice2py/Main.cpp')
-rw-r--r--cpp/src/slice2py/Main.cpp26
1 files changed, 7 insertions, 19 deletions
diff --git a/cpp/src/slice2py/Main.cpp b/cpp/src/slice2py/Main.cpp
index 226ebea9c86..7951141b1b3 100644
--- a/cpp/src/slice2py/Main.cpp
+++ b/cpp/src/slice2py/Main.cpp
@@ -34,16 +34,6 @@ using namespace Slice;
using namespace Slice::Python;
//
-// Callback for Crtl-C signal handling
-//
-static IceUtilInternal::Output _out;
-
-static void closeCallback()
-{
- _out.close();
-}
-
-//
// For each Slice file Foo.ice we generate Foo_ice.py containing the Python
// mappings. Furthermore, for each Slice module M in Foo.ice, we create a
// Python package of the same name. This package is simply a subdirectory
@@ -549,26 +539,24 @@ main(int argc, char* argv[])
}
SignalHandler::addFile(file);
- SignalHandler::setCallback(closeCallback);
-
- _out.open(file.c_str());
- if(!_out)
+ IceUtilInternal::Output out;
+ out.open(file.c_str());
+ if(!out)
{
cerr << argv[0] << ": can't open `" << file << "' for writing" << endl;
u->destroy();
return EXIT_FAILURE;
}
- printHeader(_out);
- _out << "\n# Generated from file `" << base << ".ice'\n";
+ printHeader(out);
+ out << "\n# Generated from file `" << base << ".ice'\n";
//
// Generate the Python mapping.
//
- generate(u, all, checksum, includePaths, _out);
+ generate(u, all, checksum, includePaths, out);
- _out.close();
- SignalHandler::setCallback(0);
+ out.close();
//
// Create or update the Python package hierarchy.