@@ -93,20 +93,19 @@ int main(int argc, char *argv[])
9393 org::freedesktop::systemd1::Manager systemdDBus (" org.freedesktop.systemd1" , " /org/freedesktop/systemd1" , QDBusConnection::sessionBus ());
9494 startSystemdUnit (systemdDBus, dmService, " replace" );
9595
96- QDBusServiceWatcher *watcher = new QDBusServiceWatcher (" org.deepin.dde.Session1" , QDBusConnection::sessionBus (), QDBusServiceWatcher::WatchForUnregistration);
96+ QDBusServiceWatcher *watcher = new QDBusServiceWatcher (" org.deepin.dde.Session1" , QDBusConnection::sessionBus (), QDBusServiceWatcher::WatchForUnregistration, &app );
9797 watcher->connect (watcher, &QDBusServiceWatcher::serviceUnregistered, [&] {
9898 qInfo () << " dde session exit" ;
9999 startSystemdUnit (systemdDBus, " dde-session-exit-task.service" , " replace" );
100100 qApp->quit ();
101101 });
102- pid_t curPid = getpid ();
103- QThreadPool::globalInstance ()-> start ([curPid]() {
104- qInfo ()<< " leader pipe thread id: " << QThread::currentThreadId () << " , pid: " << curPid ;
105- Fifo *fifo = new Fifo;
102+
103+ { // none block
104+ pid_t curPid = getpid () ;
105+ Fifo *fifo = new Fifo (&app) ;
106106 fifo->OpenWrite ();
107107 fifo->Write (QString::number (curPid));
108- });
109-
108+ }
110109 // We started the unit, open <dbus> and sleep forever.
111110 return app.exec ();
112111 }
@@ -116,7 +115,7 @@ int main(int argc, char *argv[])
116115 // QProcess no block "/usr/bin/deepin-keyring-whitebox", "--opt-client=waitfifonotify"),BUG-255907
117116 QProcess::startDetached (" /usr/bin/deepin-keyring-whitebox" , QStringList () << " --opt-client=waitfifonotify" );
118117
119- auto * session = new Session;
118+ auto * session = new Session (&app) ;
120119 new Session1Adaptor (session);
121120 QDBusConnection::sessionBus ().registerService (" org.deepin.dde.Session1" );
122121 QDBusConnection::sessionBus ().registerObject (" /org/deepin/dde/Session1" , " org.deepin.dde.Session1" , session);
@@ -126,7 +125,7 @@ int main(int argc, char *argv[])
126125 QDBusConnection::sessionBus ().registerService (" org.deepin.dde.SessionManager1" );
127126 QDBusConnection::sessionBus ().registerObject (" /org/deepin/dde/SessionManager1" , " org.deepin.dde.SessionManager1" , SessionManager::instance ());
128127
129- auto *wmSwitcher = new WMSwitcher ();
128+ auto *wmSwitcher = new WMSwitcher (&app );
130129 new WMSwitcher1Adaptor (wmSwitcher);
131130 QDBusConnection::sessionBus ().registerService (" org.deepin.dde.WMSwitcher1" );
132131 QDBusConnection::sessionBus ().registerObject (" /org/deepin/dde/WMSwitcher1" , wmSwitcher);
@@ -151,7 +150,7 @@ int main(int argc, char *argv[])
151150
152151 QThreadPool::globalInstance ()->start ([&session]() {
153152 qInfo ()<< " systemd service pipe thread id: " << QThread::currentThreadId ();
154- Fifo *fifo = new Fifo;
153+ Fifo *fifo = new Fifo () ;
155154 fifo->OpenRead ();
156155 qInfo () << " pipe open read finish" ;
157156 QString CurSessionPid;
@@ -166,6 +165,7 @@ int main(int argc, char *argv[])
166165 session->setSessionPath ();
167166 }
168167 }
168+ fifo->deleteLater ();
169169 qInfo () << " pipe read finish, app exit." ;
170170 qApp->quit ();
171171 });
0 commit comments