summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-10-09 14:18:11 +0200
committerMichael Stahl <mstahl@redhat.com>2013-10-09 19:46:00 +0200
commit2386a92c1e6e8ec263edb4dc4fdcfeaa4673ce1f (patch)
tree27a8b34bbf6925fc7d7b201bdbb932cfd0ae0bb4 /pyuno
parentd703c8f64c6cd650bb753cf1f6f39b3e81f06a41 (diff)
pyuno: set up fake command line in getComponentContext()
Easy to trigger the assert in osl_getCommandArgCount(), just run instdir/*/program/python and "import unohelper". Avoid that by setting up a fake command line, hopefully nobody expects to be able to give relevant args to python... Change-Id: I0df6c23d6ecbb3c2bce81a9d5bcecdcb1729ddbb
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/module/pyuno_module.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx
index d9d510a8086b..e34b675837c7 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -27,6 +27,7 @@
#include <osl/module.hxx>
#include <osl/thread.h>
+#include <osl/process.h>
#include <osl/file.hxx>
#include <typelib/typedescription.hxx>
@@ -260,6 +261,13 @@ static PyObject* getComponentContext(
}
else
{
+ // cppu::defaultBootstrap_InitialComponentContext expects
+ // command line arguments to be present
+ static char * argv [1];
+ argv[0] = strdup(
+ "this is just a fake and cheap imitation of a command line");
+ osl_setCommandArgs(1, argv);
+
OUString iniFile;
if( path.isEmpty() )
{