summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/SCsub9
-rw-r--r--platform/android/SCsub8
-rw-r--r--platform/android/detect.py54
-rw-r--r--platform/iphone/camera_ios.mm2
-rw-r--r--platform/iphone/export/export.cpp3
-rw-r--r--platform/javascript/detect.py1
-rw-r--r--platform/osx/os_osx.mm5
-rw-r--r--platform/server/detect.py7
-rw-r--r--platform/server/os_server.cpp4
-rw-r--r--platform/server/os_server.h1
-rw-r--r--platform/uwp/export/export.cpp4
-rw-r--r--platform/windows/os_windows.cpp19
-rw-r--r--platform/x11/detect.py7
-rw-r--r--platform/x11/joypad_linux.cpp2
-rw-r--r--platform/x11/os_x11.cpp5
-rw-r--r--platform/x11/power_x11.cpp4
16 files changed, 78 insertions, 57 deletions
diff --git a/platform/SCsub b/platform/SCsub
index aa83154ee0..20c89ae8c6 100644
--- a/platform/SCsub
+++ b/platform/SCsub
@@ -3,7 +3,8 @@
from compat import open_utf8
Import('env')
-platform_sources = []
+
+env.platform_sources = []
# Register platform-exclusive APIs
reg_apis_inc = '#include "register_platform_apis.h"\n'
@@ -11,7 +12,7 @@ reg_apis = 'void register_platform_apis() {\n'
unreg_apis = 'void unregister_platform_apis() {\n'
for platform in env.platform_apis:
platform_dir = env.Dir(platform)
- platform_sources.append(platform_dir.File('api/api.cpp'))
+ env.add_source_files(env.platform_sources, platform + '/api/api.cpp')
reg_apis += '\tregister_' + platform + '_api();\n'
unreg_apis += '\tunregister_' + platform + '_api();\n'
reg_apis_inc += '#include "' + platform + '/api/api.h"\n'
@@ -25,7 +26,7 @@ with open_utf8('register_platform_apis.gen.cpp', 'w') as f:
f.write(reg_apis)
f.write(unreg_apis)
-platform_sources.append('register_platform_apis.gen.cpp')
+env.add_source_files(env.platform_sources, 'register_platform_apis.gen.cpp')
-lib = env.add_library('platform', platform_sources)
+lib = env.add_library('platform', env.platform_sources)
env.Prepend(LIBS=lib)
diff --git a/platform/android/SCsub b/platform/android/SCsub
index cf6752fa54..e355caf0f9 100644
--- a/platform/android/SCsub
+++ b/platform/android/SCsub
@@ -2,7 +2,6 @@
Import('env')
-from compat import open_utf8
from distutils.version import LooseVersion
from detect import get_ndk_version
@@ -54,7 +53,6 @@ if lib_arch_dir != '':
out_dir = '#platform/android/java/libs/' + lib_type_dir + '/' + lib_arch_dir
env_android.Command(out_dir + '/libgodot_android.so', '#bin/libgodot' + env['SHLIBSUFFIX'], Move("$TARGET", "$SOURCE"))
- ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
- if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"):
- stl_lib_path = str(env['ANDROID_NDK_ROOT']) + '/sources/cxx-stl/llvm-libc++/libs/' + lib_arch_dir + '/libc++_shared.so'
- env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE"))
+
+ stl_lib_path = str(env['ANDROID_NDK_ROOT']) + '/sources/cxx-stl/llvm-libc++/libs/' + lib_arch_dir + '/libc++_shared.so'
+ env_android.Command(out_dir + '/libc++_shared.so', stl_lib_path, Copy("$TARGET", "$SOURCE"))
diff --git a/platform/android/detect.py b/platform/android/detect.py
index 3f179e3a65..283791f336 100644
--- a/platform/android/detect.py
+++ b/platform/android/detect.py
@@ -28,7 +28,6 @@ def get_opts():
('ndk_platform', 'Target platform (android-<api>, e.g. "android-18")', "android-18"),
EnumVariable('android_arch', 'Target architecture', "armv7", ('armv7', 'arm64v8', 'x86', 'x86_64')),
BoolVariable('android_neon', 'Enable NEON support (armv7 only)', True),
- BoolVariable('android_stl', 'Enable Android STL support (for modules)', True)
]
@@ -205,31 +204,29 @@ def configure(env):
common_opts = ['-fno-integrated-as', '-gcc-toolchain', gcc_toolchain_path]
- lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env['ndk_platform'] + "/" + env['ARCH']
-
## Compile flags
+
+ env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/include"])
+ env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++abi/include"])
+ env.Append(CXXFLAGS=["-std=gnu++14"])
+
# Disable exceptions and rtti on non-tools (template) builds
- if env['tools'] or env['android_stl']:
- env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/include"])
- env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++abi/include"])
- env.Append(CXXFLAGS=['-frtti', "-std=gnu++14"])
+ if env['tools']:
+ env.Append(CXXFLAGS=['-frtti'])
else:
env.Append(CXXFLAGS=['-fno-rtti', '-fno-exceptions'])
# Don't use dynamic_cast, necessary with no-rtti.
env.Append(CPPDEFINES=['NO_SAFE_CAST'])
- ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
- if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"):
- print("Using NDK unified headers")
- sysroot = env["ANDROID_NDK_ROOT"] + "/sysroot"
- env.Append(CPPFLAGS=["--sysroot=" + sysroot])
- env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include/" + abi_subpath])
- env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/android/support/include"])
- # For unified headers this define has to be set manually
- env.Append(CPPDEFINES=[('__ANDROID_API__', str(get_platform(env['ndk_platform'])))])
- else:
- print("Using NDK deprecated headers")
- env.Append(CPPFLAGS=["-isystem", lib_sysroot + "/usr/include"])
+ lib_sysroot = env["ANDROID_NDK_ROOT"] + "/platforms/" + env['ndk_platform'] + "/" + env['ARCH']
+
+ # Using NDK unified headers (NDK r15+)
+ sysroot = env["ANDROID_NDK_ROOT"] + "/sysroot"
+ env.Append(CPPFLAGS=["--sysroot=" + sysroot])
+ env.Append(CPPFLAGS=["-isystem", sysroot + "/usr/include/" + abi_subpath])
+ env.Append(CPPFLAGS=["-isystem", env["ANDROID_NDK_ROOT"] + "/sources/android/support/include"])
+ # For unified headers this define has to be set manually
+ env.Append(CPPDEFINES=[('__ANDROID_API__', str(get_platform(env['ndk_platform'])))])
env.Append(CCFLAGS='-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing'.split())
env.Append(CPPDEFINES=['NO_STATVFS', 'GLES_ENABLED'])
@@ -263,18 +260,15 @@ def configure(env):
env.Append(CCFLAGS=common_opts)
## Link flags
- if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("15.0.4075724"):
- if LooseVersion(ndk_version) >= LooseVersion("17.1.4828580"):
- env.Append(LINKFLAGS=['-Wl,--exclude-libs,libgcc.a', '-Wl,--exclude-libs,libatomic.a', '-nostdlib++'])
- else:
- env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libandroid_support.a"])
- env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
- env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/"])
- env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] +"/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libc++_shared.so"])
+
+ ndk_version = get_ndk_version(env["ANDROID_NDK_ROOT"])
+ if ndk_version != None and LooseVersion(ndk_version) >= LooseVersion("17.1.4828580"):
+ env.Append(LINKFLAGS=['-Wl,--exclude-libs,libgcc.a', '-Wl,--exclude-libs,libatomic.a', '-nostdlib++'])
else:
- env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
- if mt_link:
- env.Append(LINKFLAGS=['-Wl,--threads'])
+ env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libandroid_support.a"])
+ env.Append(LINKFLAGS=['-shared', '--sysroot=' + lib_sysroot, '-Wl,--warn-shared-textrel'])
+ env.Append(LIBPATH=[env["ANDROID_NDK_ROOT"] + "/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/"])
+ env.Append(LINKFLAGS=[env["ANDROID_NDK_ROOT"] +"/sources/cxx-stl/llvm-libc++/libs/" + arch_subpath + "/libc++_shared.so"])
if env["android_arch"] == "armv7":
env.Append(LINKFLAGS='-Wl,--fix-cortex-a8'.split())
diff --git a/platform/iphone/camera_ios.mm b/platform/iphone/camera_ios.mm
index 029ce6debf..ff84df66ff 100644
--- a/platform/iphone/camera_ios.mm
+++ b/platform/iphone/camera_ios.mm
@@ -158,7 +158,7 @@
} else if (dataCbCr == NULL) {
print_line("Couldn't access CbCr pixel buffer data");
} else {
- UIDeviceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
+ UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
Ref<Image> img[2];
{
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 85a45d62f8..a179b36bd5 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -768,7 +768,8 @@ Error EditorExportPlatformIOS::_export_additional_assets(const String &p_out_dir
DirAccess *da = DirAccess::create_for_path(asset);
if (!da) {
memdelete(filesystem_da);
- ERR_FAIL_COND_V(!da, ERR_CANT_CREATE);
+ ERR_EXPLAIN("Can't create directory: " + asset);
+ ERR_FAIL_V(ERR_CANT_CREATE);
}
bool file_exists = da->file_exists(asset);
bool dir_exists = da->dir_exists(asset);
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 10680ad1f5..ac43392700 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -128,7 +128,6 @@ def configure(env):
## Link flags
env.Append(LINKFLAGS=['-s', 'BINARYEN=1'])
- env.Append(LINKFLAGS=['-s', 'BINARYEN_TRAP_MODE=\'clamp\''])
# Allow increasing memory buffer size during runtime. This is efficient
# when using WebAssembly (in comparison to asm.js) and works well for
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 726882438b..a48f784529 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1599,6 +1599,7 @@ void OS_OSX::finalize() {
memdelete(joypad_osx);
memdelete(input);
+ cursors_cache.clear();
visual_server->finish();
memdelete(visual_server);
//memdelete(rasterizer);
@@ -2410,7 +2411,7 @@ Size2 OS_OSX::get_min_window_size() const {
void OS_OSX::set_min_window_size(const Size2 p_size) {
if ((p_size != Size2()) && (max_size != Size2()) && ((p_size.x > max_size.x) || (p_size.y > max_size.y))) {
- WARN_PRINT("Minimum window size can't be larger than maximum window size!");
+ ERR_PRINT("Minimum window size can't be larger than maximum window size!");
return;
}
min_size = p_size;
@@ -2426,7 +2427,7 @@ void OS_OSX::set_min_window_size(const Size2 p_size) {
void OS_OSX::set_max_window_size(const Size2 p_size) {
if ((p_size != Size2()) && ((p_size.x < min_size.x) || (p_size.y < min_size.y))) {
- WARN_PRINT("Maximum window size can't be smaller than minimum window size!");
+ ERR_PRINT("Maximum window size can't be smaller than minimum window size!");
return;
}
max_size = p_size;
diff --git a/platform/server/detect.py b/platform/server/detect.py
index 185dce8128..b6028c20e3 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -35,6 +35,7 @@ def get_opts():
BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False),
+ BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', False),
EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
BoolVariable('separate_debug_symbols', 'Create a separate file containing debugging symbols', False),
BoolVariable('execinfo', 'Use libexecinfo on systems where glibc is not available', False),
@@ -99,7 +100,7 @@ def configure(env):
env.extra_suffix = ".llvm" + env.extra_suffix
- if env['use_ubsan'] or env['use_asan'] or env['use_lsan']:
+ if env['use_ubsan'] or env['use_asan'] or env['use_lsan'] or env['use_tsan']:
env.extra_suffix += "s"
if env['use_ubsan']:
@@ -114,6 +115,10 @@ def configure(env):
env.Append(CCFLAGS=['-fsanitize=leak'])
env.Append(LINKFLAGS=['-fsanitize=leak'])
+ if env['use_tsan']:
+ env.Append(CCFLAGS=['-fsanitize=thread'])
+ env.Append(LINKFLAGS=['-fsanitize=thread'])
+
if env['use_lto']:
env.Append(CCFLAGS=['-flto'])
if not env['use_llvm'] and env.GetOption("num_jobs") > 1:
diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp
index 12e53054bc..87dc6421ac 100644
--- a/platform/server/os_server.cpp
+++ b/platform/server/os_server.cpp
@@ -88,6 +88,8 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int
visual_server = memnew(VisualServerRaster);
visual_server->init();
+ camera_server = memnew(CameraServer);
+
AudioDriverManager::initialize(p_audio_driver);
input = memnew(InputDefault);
@@ -117,6 +119,8 @@ void OS_Server::finalize() {
memdelete(input);
+ memdelete(camera_server);
+
memdelete(power_manager);
ResourceLoader::remove_resource_format_loader(resource_loader_dummy);
diff --git a/platform/server/os_server.h b/platform/server/os_server.h
index e3488a693d..dbdae6afb1 100644
--- a/platform/server/os_server.h
+++ b/platform/server/os_server.h
@@ -74,6 +74,7 @@ class OS_Server : public OS_Unix {
#endif
CrashHandler crash_handler;
+ CameraServer *camera_server;
int video_driver_index;
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index abb7b391d3..75ce422e9e 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -519,7 +519,9 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
int total_out_before = strm.total_out;
- deflate(&strm, Z_FULL_FLUSH);
+ int err = deflate(&strm, Z_FULL_FLUSH);
+ ERR_FAIL_COND_V(err >= 0, ERR_BUG); // Negative means bug
+
bh.compressed_size = strm.total_out - total_out_before;
//package->store_buffer(strm_out.ptr(), strm.total_out - total_out_before);
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 745f3ce379..db4575a0cb 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -719,7 +719,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
pressrc = 0;
}
}
- } else if (mouse_mode != MOUSE_MODE_CAPTURED) {
+ } else {
// for reasons unknown to mankind, wheel comes in screen coordinates
POINT coords;
coords.x = mb->get_position().x;
@@ -1537,6 +1537,7 @@ void OS_Windows::finalize() {
memdelete(camera_server);
touch_state.clear();
+ cursors_cache.clear();
visual_server->finish();
memdelete(visual_server);
#ifdef OPENGL_ENABLED
@@ -1812,7 +1813,7 @@ Size2 OS_Windows::get_min_window_size() const {
void OS_Windows::set_min_window_size(const Size2 p_size) {
if ((p_size != Size2()) && (max_size != Size2()) && ((p_size.x > max_size.x) || (p_size.y > max_size.y))) {
- WARN_PRINT("Minimum window size can't be larger than maximum window size!");
+ ERR_PRINT("Minimum window size can't be larger than maximum window size!");
return;
}
min_size = p_size;
@@ -1821,7 +1822,7 @@ void OS_Windows::set_min_window_size(const Size2 p_size) {
void OS_Windows::set_max_window_size(const Size2 p_size) {
if ((p_size != Size2()) && ((p_size.x < min_size.x) || (p_size.y < min_size.y))) {
- WARN_PRINT("Maximum window size can't be smaller than minimum window size!");
+ ERR_PRINT("Maximum window size can't be smaller than minimum window size!");
return;
}
max_size = p_size;
@@ -2251,9 +2252,17 @@ uint64_t OS_Windows::get_unix_time() const {
FILETIME fep;
SystemTimeToFileTime(&ep, &fep);
- // FIXME: dereferencing type-punned pointer will break strict-aliasing rules (GCC warning)
+ // Type punning through unions (rather than pointer cast) as per:
// https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime#remarks
- return (*(uint64_t *)&ft - *(uint64_t *)&fep) / 10000000;
+ ULARGE_INTEGER ft_punning;
+ ft_punning.LowPart = ft.dwLowDateTime;
+ ft_punning.HighPart = ft.dwHighDateTime;
+
+ ULARGE_INTEGER fep_punning;
+ fep_punning.LowPart = fep.dwLowDateTime;
+ fep_punning.HighPart = fep.dwHighDateTime;
+
+ return (ft_punning.QuadPart - fep_punning.QuadPart) / 10000000;
};
uint64_t OS_Windows::get_system_time_secs() const {
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index f3a486df02..b8ff97279d 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -64,6 +64,7 @@ def get_opts():
BoolVariable('use_ubsan', 'Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)', False),
BoolVariable('use_asan', 'Use LLVM/GCC compiler address sanitizer (ASAN))', False),
BoolVariable('use_lsan', 'Use LLVM/GCC compiler leak sanitizer (LSAN))', False),
+ BoolVariable('use_tsan', 'Use LLVM/GCC compiler thread sanitizer (TSAN))', False),
BoolVariable('pulseaudio', 'Detect and use PulseAudio', True),
BoolVariable('udev', 'Use udev for gamepad connection callbacks', False),
EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
@@ -140,7 +141,7 @@ def configure(env):
print("Using LLD with GCC is not supported yet, try compiling with 'use_llvm=yes'.")
sys.exit(255)
- if env['use_ubsan'] or env['use_asan'] or env['use_lsan']:
+ if env['use_ubsan'] or env['use_asan'] or env['use_lsan'] or env['use_tsan']:
env.extra_suffix += "s"
if env['use_ubsan']:
@@ -155,6 +156,10 @@ def configure(env):
env.Append(CCFLAGS=['-fsanitize=leak'])
env.Append(LINKFLAGS=['-fsanitize=leak'])
+ if env['use_tsan']:
+ env.Append(CCFLAGS=['-fsanitize=thread'])
+ env.Append(LINKFLAGS=['-fsanitize=thread'])
+
if env['use_lto']:
if not env['use_llvm'] and env.GetOption("num_jobs") > 1:
env.Append(CCFLAGS=['-flto'])
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index e6328ee14d..4242952374 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -513,6 +513,8 @@ void JoypadLinux::process_joypads() {
break;
default:
+ if (ev.code >= MAX_ABS)
+ return;
if (joy->abs_map[ev.code] != -1 && joy->abs_info[ev.code]) {
InputDefault::JoyAxis value = axis_correct(joy->abs_info[ev.code], ev.value);
joy->curr_axis[joy->abs_map[ev.code]] = value;
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 9b35648046..0d1e702d04 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -788,6 +788,7 @@ void OS_X11::finalize() {
memdelete(camera_server);
+ cursors_cache.clear();
visual_server->finish();
memdelete(visual_server);
//memdelete(rasterizer);
@@ -1265,7 +1266,7 @@ Size2 OS_X11::get_min_window_size() const {
void OS_X11::set_min_window_size(const Size2 p_size) {
if ((p_size != Size2()) && (max_size != Size2()) && ((p_size.x > max_size.x) || (p_size.y > max_size.y))) {
- WARN_PRINT("Minimum window size can't be larger than maximum window size!");
+ ERR_PRINT("Minimum window size can't be larger than maximum window size!");
return;
}
min_size = p_size;
@@ -1294,7 +1295,7 @@ void OS_X11::set_min_window_size(const Size2 p_size) {
void OS_X11::set_max_window_size(const Size2 p_size) {
if ((p_size != Size2()) && ((p_size.x < min_size.x) || (p_size.y < min_size.y))) {
- WARN_PRINT("Maximum window size can't be smaller than minimum window size!");
+ ERR_PRINT("Maximum window size can't be smaller than minimum window size!");
return;
}
max_size = p_size;
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp
index 758bd84114..c33c77e16b 100644
--- a/platform/x11/power_x11.cpp
+++ b/platform/x11/power_x11.cpp
@@ -268,9 +268,7 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
check_proc_acpi_battery(node.utf8().get_data(), &have_battery, &charging /*, seconds, percent*/);
node = dirp->get_next();
}
- memdelete(dirp);
}
-
dirp->change_dir(proc_acpi_ac_adapter_path);
err = dirp->list_dir_begin();
if (err != OK) {
@@ -281,7 +279,6 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
check_proc_acpi_ac_adapter(node.utf8().get_data(), &have_ac);
node = dirp->get_next();
}
- memdelete(dirp);
}
if (!have_battery) {
@@ -294,6 +291,7 @@ bool PowerX11::GetPowerInfo_Linux_proc_acpi() {
this->power_state = OS::POWERSTATE_ON_BATTERY;
}
+ memdelete(dirp);
return true; /* definitive answer. */
}