Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KSystemStats
Commits
165a60b3
Commit
165a60b3
authored
May 12, 2021
by
David Redondo
🏎
Browse files
Do not call libsensors init or cleanup functions from plugin
Doing so multiple times in the same process will lead to crashes.
parent
8208a151
Changes
2
Hide whitespace changes
Inline
Side-by-side
plugins/cpu/linuxcpuplugin.cpp
View file @
165a60b3
...
...
@@ -11,6 +11,7 @@
#include
<KLocalizedString>
#include
<systemstats/SensorContainer.h>
#include
<systemstats/SensorPlugin.h>
#ifdef HAVE_SENSORS
#include
<sensors/sensors.h>
...
...
@@ -127,7 +128,9 @@ void LinuxCpuPluginPrivate::update()
void
LinuxCpuPluginPrivate
::
addSensors
()
{
#ifdef HAVE_SENSORS
sensors_init
(
nullptr
);
if
(
!
KSysGuard
::
SensorPlugin
::
initLibSensors
())
{
return
;
}
int
number
=
0
;
while
(
const
sensors_chip_name
*
const
chipName
=
sensors_get_detected_chips
(
nullptr
,
&
number
))
{
char
name
[
100
];
...
...
plugins/lmsensors/lmsensors.cpp
View file @
165a60b3
...
...
@@ -20,7 +20,7 @@ LmSensorsPlugin::LmSensorsPlugin(QObject *parent, const QVariantList &args)
:
KSysGuard
::
SensorPlugin
(
parent
,
args
)
{
auto
container
=
new
KSysGuard
::
SensorContainer
(
QStringLiteral
(
"lmsensors"
),
i18n
(
"Hardware Sensors"
),
this
);
if
(
sensors_init
(
nullptr
)
!=
0
)
{
if
(
!
initLibSensors
()
)
{
return
;
}
...
...
@@ -50,7 +50,6 @@ LmSensorsPlugin::LmSensorsPlugin(QObject *parent, const QVariantList &args)
LmSensorsPlugin
::~
LmSensorsPlugin
()
{
sensors_cleanup
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment