Revert "Fall back to old bootstrap.ini [Win32] section, for backwards compatibility"

This reverts commit ebd3f0971b.
Conflicts:
	desktop/win32/source/loader.cxx
	vcl/win/window/salframe.cxx

Reason for revert:  This fallback functionality was documented as deprecated at
<https://wiki.documentfoundation.org/index.php?title=ReleaseNotes/24.8&oldid=738731>
"fundamental.override.ini", to "be removed in a later version", which is
happening now for LO 25.2.

Change-Id: I40a1800f6a05fc7fd7188917083b269ce6a9f1d2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163394
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
Stephan Bergmann 2024-02-15 10:54:33 +01:00
parent 9a92a4355e
commit 250f35740d
2 changed files with 1 additions and 62 deletions

View file

@ -218,8 +218,6 @@ int officeloader_impl(bool bAllowConsole)
// read limit values from fundamental.override.ini
unsigned int nMaxMemoryInMB = 0;
bool bExcludeChildProcesses = true;
bool fallbackForMaxMemoryInMB = true;
bool fallbackForExcludeChildProcesses = true;
try
{
@ -227,34 +225,12 @@ int officeloader_impl(bool bAllowConsole)
std::ifstream aFile(szIniDirectory + L"\\fundamental.override.ini");
boost::property_tree::ini_parser::read_ini(aFile, pt);
nMaxMemoryInMB = pt.get("Bootstrap.LimitMaximumMemoryInMB", nMaxMemoryInMB);
fallbackForMaxMemoryInMB = !pt.get_child_optional("Bootstrap.LimitMaximumMemoryInMB");
bExcludeChildProcesses = pt.get("Bootstrap.ExcludeChildProcessesFromLimit", bExcludeChildProcesses);
fallbackForExcludeChildProcesses
= !pt.get_child_optional("Bootstrap.ExcludeChildProcessesFromLimit");
}
catch (...)
{
nMaxMemoryInMB = 0;
}
// For backwards compatibility, for now also try to read the values from bootstrap.ini if
// fundamental.override.ini does not provide them:
if (fallbackForMaxMemoryInMB || fallbackForExcludeChildProcesses) {
try
{
boost::property_tree::ptree pt;
std::ifstream aFile(szIniDirectory + L"\\bootstrap.ini");
boost::property_tree::ini_parser::read_ini(aFile, pt);
if (fallbackForMaxMemoryInMB) {
nMaxMemoryInMB = pt.get("Win32.LimitMaximumMemoryInMB", nMaxMemoryInMB);
}
if (fallbackForExcludeChildProcesses) {
bExcludeChildProcesses = pt.get("Win32.ExcludeChildProcessesFromLimit", bExcludeChildProcesses);
}
}
catch (...)
{
}
}
// create a Windows JobObject with a memory limit
HANDLE hJobObject = nullptr;

View file

@ -32,12 +32,6 @@
#include <comphelper/windowserrorstring.hxx>
#include <fstream>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <osl/file.hxx>
#include <osl/process.h>
#include <rtl/bootstrap.hxx>
#include <rtl/character.hxx>
#include <rtl/string.h>
@ -1958,38 +1952,7 @@ static bool EnableAttachThreadInputHack()
{
OUString s("$EnableAttachThreadInputHack");
rtl::Bootstrap::expandMacros(s);
bool bEnabled;
if (!s.isEmpty()) {
bEnabled = s == "true";
} else {
// For backwards compatibility, for now also try to read the value from a [Win32] section of
// bootstrap.ini if it is not set as a bootstrap variable:
bEnabled = false;
OUString aBootstrapUri;
if (osl_getProcessWorkingDir(&aBootstrapUri.pData) == osl_Process_E_None) {
aBootstrapUri += "/bootstrap.ini";
OUString aSystemFileName;
if (osl::FileBase::getSystemPathFromFileURL(aBootstrapUri, aSystemFileName)
== osl::FileBase::E_None
&& aSystemFileName.getLength() <= MAX_PATH)
{
// this uses the Boost ini parser, instead of tools::Config, as we already use it to
// read other values from bootstrap.ini in desktop/win32/source/loader.cxx, because
// that watchdog process can't access LO libs. This way the handling is consistent.
try
{
boost::property_tree::ptree pt;
std::ifstream aFile(o3tl::toW(aSystemFileName.getStr()));
boost::property_tree::ini_parser::read_ini(aFile, pt);
bEnabled = pt.get("Win32.EnableAttachThreadInputHack", false);
}
catch (...)
{
}
}
}
}
const bool bEnabled = s == "true";
SAL_WARN_IF(bEnabled, "vcl", "AttachThreadInput hack is enabled. Watch out for deadlocks!");
return bEnabled;
}