From 2386a92c1e6e8ec263edb4dc4fdcfeaa4673ce1f Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Wed, 9 Oct 2013 14:18:11 +0200 Subject: 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 --- pyuno/source/module/pyuno_module.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'pyuno') 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 #include +#include #include #include @@ -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() ) { -- cgit