lxqt / qtermwidget

The terminal widget for QTerminal
https://lxqt.github.io
GNU General Public License v2.0
506 stars 255 forks source link

virtual KPtyProcess::~KPtyProcess() the terminal process is still running, trying to stop it by SIGHUP #566

Open tsujan opened 3 days ago

tsujan commented 3 days ago

The message of the title might happen repeatedly in the log (actually, each time a terminal window is closed) if I don't disable Qt warnings inside ~/.config/QtProject/qtlogging.ini. It's caused by these lines in the d-tor of KPtyProcess:

https://github.com/lxqt/qtermwidget/blob/df7297b3e372934cfa787cc3f92db9d18ec0e00b/lib/kptyprocess.cpp#L96-L104

Qt doc says that QProcess::~QProcess() will not return until the process is terminated.

IMO, waiting for the finished() signal inside the d-tor of a QProcess isn't OK. I checked KDE's kptykptyprocess.cpp. They either never used waitForFinished() there or removed it a long time ago. ~Will use QTerminal without it for a while to test…~

tsujan commented 3 days ago

@palinek This is a general question about QProcess. Any thought on it?

tsujan commented 3 days ago

Oh, it was added here 4 years ago, by @palinek: https://github.com/lxqt/qtermwidget/pull/171. Without it, this message is shown instead: QProcess: Destroyed while process ("/bin/bash") is still running.

Maybe another method needs to be found, because Konsole doesn't have this problem.

EDIT: Found a way by consulting Konsole's code.