thermald/thermald-1.6-fix_dbus_re-init_accessing_deleted_pointer.patch
Björn Esser 5edf9f427d Add upstream patch to fix ThermalMonitor (rhbz#1464548)
Add several fixes from upstream
2017-06-30 10:30:51 +02:00

41 lines
1.3 KiB
Diff

From 9c5d8354dd8efff340a030c05f7beda03061cd0a Mon Sep 17 00:00:00 2001
From: testuser <testuser>
Date: Thu, 29 Jun 2017 17:24:51 -0700
Subject: [PATCH] Fix dbus re-init accessing deleted pointer
As Colin King found, there is issue during reinit.
thd_engine is deleted and then getting accessed.
So store the parameters before deleting the thd_engine.
---
src/thd_dbus_interface.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/thd_dbus_interface.cpp b/src/thd_dbus_interface.cpp
index b8e4ab0..6d0265d 100644
--- a/src/thd_dbus_interface.cpp
+++ b/src/thd_dbus_interface.cpp
@@ -199,10 +199,6 @@ gboolean thd_dbus_interface_terminate(PrefObject *obj, GError **error) {
gboolean thd_dbus_interface_reinit(PrefObject *obj, GError **error) {
bool exclusive_control = false;
- thd_engine->thd_engine_terminate();
- sleep(1);
- delete thd_engine;
- sleep(2);
if (thd_engine->get_control_mode() == EXCLUSIVE)
exclusive_control = true;
@@ -211,6 +207,12 @@ gboolean thd_dbus_interface_reinit(PrefObject *obj, GError **error) {
if (!config_file.empty())
conf_file = config_file.c_str();
+ thd_engine->thd_engine_terminate();
+ sleep(1);
+ delete thd_engine;
+ sleep(2);
+
+
if (thd_engine_create_default_engine(true, exclusive_control,
conf_file) != THD_SUCCESS) {
return FALSE;