summaryrefslogtreecommitdiffstats
path: root/arch/tde-core/tde-tdelibs/bp000-41336d84c9.diff
blob: ab9a9513b1b4eee797b02bef7ed40352363b14cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
commit 41336d84c91181da148be31a0b9f469037d3669d
Author: Michele Calgaro <michele.calgaro@yahoo.it>
Date:   Mon Jun 12 22:15:53 2023 +0900

    Rework and fix commit 4d90cc61
    
    Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
    (cherry picked from commit 54b58986491c48408c720d706e5cbfd1043d3ee6)

diff --git a/tdeio/tdeio/job.cpp b/tdeio/tdeio/job.cpp
index 43b0c808..cbe1a81d 100644
--- a/tdeio/tdeio/job.cpp
+++ b/tdeio/tdeio/job.cpp
@@ -114,9 +114,18 @@ public:
     unsigned long m_userTimestamp;
 };
 
-static TQObject *__job_root_obj = new TQObject(0, "jobroot");
+static TQObject *__job_root_obj = nullptr;
 
-Job::Job(bool showProgressInfo) : TQObject(__job_root_obj, "job"), m_error(0), m_percent(0)
+static TQObject* __getJobRoot()
+{
+    if (!__job_root_obj)
+    {
+        __job_root_obj = new TQObject(0, "jobroot");
+    }
+    return __job_root_obj;
+}
+
+Job::Job(bool showProgressInfo) : TQObject(__getJobRoot(), "job"), m_error(0), m_percent(0)
    , m_progressId(0), m_speedTimer(0), d( new JobPrivate )
 {
     // All jobs delete themselves after emiting 'result'.