[X2Go-Commits] [x2goclient] 01/02: Revert "Add x2gohelper to start X2Go Client on Windows and clean child processes if X2Go Client crashes."
git-admin at x2go.org
git-admin at x2go.org
Tue Jul 8 17:28:39 CEST 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goclient.
commit 0f51f82ba073603f568e126d4fc60c4117f7953f
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Tue Jul 8 17:27:00 2014 +0200
Revert "Add x2gohelper to start X2Go Client on Windows and clean child processes if X2Go Client crashes."
This reverts commit 3d76d001c18fef4f88cb98c598a5841be4d7ee96.
---
config_win.bat | 5 +--
debian/changelog | 2 -
ongetpass.cpp | 78 +++++++++++++++++++++++++++++++++++++++
onmainwindow.cpp | 6 +++
x2gohelper/x2gohelper.cpp | 90 ---------------------------------------------
x2gohelper/x2gohelper.pro | 14 -------
6 files changed, 85 insertions(+), 110 deletions(-)
diff --git a/config_win.bat b/config_win.bat
index 8bd1f36..695b3e2 100755
--- a/config_win.bat
+++ b/config_win.bat
@@ -2,7 +2,4 @@ mingw32-make distclean
lrelease x2goclient.pro
set X2GO_CLIENT_TARGET=
qmake
-cd x2gohelper
-mingw32-make distclean
-qmake
-cd ..
+
diff --git a/debian/changelog b/debian/changelog
index 2916b7d..f4e8419 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -53,8 +53,6 @@ x2goclient (4.0.2.1-0x2go1) UNRELEASED; urgency=low
- Update string "&Clipboard Mode" and translate in russian translation file.
- Grammar fix in russian translation.
- Fix "fullscreen" mode on Windows 7 with multiple monitors.
- - Add x2gohelper to start X2Go Client on Windows and clean child processes if
- X2Go Client crashes.
[ Mike DePaulo ]
* New upstream release (4.0.2.1):
diff --git a/ongetpass.cpp b/ongetpass.cpp
index e88cbe5..3d65b2e 100644
--- a/ongetpass.cpp
+++ b/ongetpass.cpp
@@ -33,8 +33,11 @@
#ifndef Q_OS_WIN
#include <sys/types.h>
#include <signal.h>
+#else
+#include <iostream>
#endif
+
#include <QPlastiqueStyle>
#include <QMessageBox>
#include <iostream>
@@ -42,8 +45,54 @@
#include <QProcess>
#include <QLocalSocket>
#include "x2gologdebug.h"
+using namespace std;
+
+#ifdef Q_OS_WIN
+#include <TlHelp32.h>
+void killProcess(DWORD pid)
+{
+ HANDLE handle=OpenProcess(PROCESS_TERMINATE,0,pid);
+ if(!handle)
+ {
+// qCritical()<<"failed to open process";
+ return;
+ }
+ if(!TerminateProcess(handle,0))
+ {
+// qCritical()<<"failed to terminate process";
+ return;
+ }
+ CloseHandle(handle);
+// qCritical()<<pid<<" terminated";
+}
+
+void enumerateFromParent(DWORD pid)
+{
+ HANDLE hndl=CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
+ if(hndl==INVALID_HANDLE_VALUE)
+ {
+ qCritical()<<"failed to get system snapshot";
+ return;
+ }
+ PROCESSENTRY32 pentry;
+ pentry.dwSize = sizeof( PROCESSENTRY32 );
+ if( Process32First(hndl,&pentry))
+ {
+ while(Process32Next(hndl,&pentry))
+ {
+ if(pid==pentry.th32ParentProcessID)
+ {
+ enumerateFromParent(pentry.th32ProcessID);
+// qCritical()<<"terminating "<<pentry.th32ProcessID<<":"<<QString::fromWCharArray ( pentry.szExeFile);
+ killProcess(pentry.th32ProcessID);
+ }
+ }
+ }
+ CloseHandle(hndl);
+}
+#endif
int x2goMain ( int argc, char *argv[] )
{
@@ -101,6 +150,35 @@ int x2goMain ( int argc, char *argv[] )
#ifdef CFGCLIENT
else
{
+#ifdef Q_OS_WIN
+ if(argc <=1)
+ {
+ args=app.arguments();
+ }
+ if(args.count()<2 || args[1].indexOf("--child-process")==-1)
+ {
+ QProcess proc;
+ QString executable=args[0];
+ args.pop_front();
+ args.push_front("--child-process");
+ proc.start(executable, args);
+ if(!proc.waitForStarted(4000))
+ {
+ qCritical()<<"Can't start process";
+ return -1;
+ }
+ DWORD pid=proc.pid()->dwProcessId;
+ while(!proc.waitForFinished(300))
+ {
+ QString err=proc.readAllStandardError();
+ QString out=proc.readAllStandardOutput();
+ std::cerr<<err.toStdString();
+ std::cout<<out.toStdString();
+ }
+ enumerateFromParent(pid);
+ return 0;
+ }
+#endif //Q_OS_WIN
ONMainWindow* mw = new ONMainWindow;
mw->show();
return app.exec();
diff --git a/onmainwindow.cpp b/onmainwindow.cpp
index 8390cbe..05ed0d9 100644
--- a/onmainwindow.cpp
+++ b/onmainwindow.cpp
@@ -6786,6 +6786,12 @@ bool ONMainWindow::parseParameter ( QString param )
closeDisconnect=true;
return true;
}
+#ifdef Q_OS_WIN
+ if ( param=="--child-process" )
+ {
+ return true;
+ }
+#endif
QString setting,value;
QStringList vals=param.split ( "=" );
diff --git a/x2gohelper/x2gohelper.cpp b/x2gohelper/x2gohelper.cpp
deleted file mode 100644
index 5f0bd42..0000000
--- a/x2gohelper/x2gohelper.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/**************************************************************************
-* Copyright (C) 2005-2014 by Oleksandr Shneyder *
-* o.shneyder at phoca-gmbh.de *
-* *
-* This program is free software; you can redistribute it and/or modify *
-* it under the terms of the GNU General Public License as published by *
-* the Free Software Foundation; either version 2 of the License, or *
-* (at your option) any later version. *
-* This program is distributed in the hope that it will be useful, *
-* but WITHOUT ANY WARRANTY; without even the implied warranty of *
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
-* GNU General Public License for more details. *
-* *
-* You should have received a copy of the GNU General Public License *
-* along with this program. If not, see <http://www.gnu.org/licenses/>. *
-***************************************************************************/
-#include <iostream>
-using namespace std;
-#include <windows.h>
-#include <TlHelp32.h>
-
-#include <QStringList>
-#include <QProcess>
-#include <QDebug>
-
-void killProcess(DWORD pid)
-{
- HANDLE handle=OpenProcess(PROCESS_TERMINATE,0,pid);
- if(!handle)
- {
- return;
- }
- if(!TerminateProcess(handle,0))
- {
- return;
- }
- CloseHandle(handle);
-}
-
-void enumerateFromParent(DWORD pid)
-{
- HANDLE hndl=CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
- if(hndl==INVALID_HANDLE_VALUE)
- {
- qCritical()<<"failed to get system snapshot";
- return;
- }
- PROCESSENTRY32 pentry;
- pentry.dwSize = sizeof( PROCESSENTRY32 );
- if( Process32First(hndl,&pentry))
- {
- while(Process32Next(hndl,&pentry))
- {
- if(pid==pentry.th32ParentProcessID)
- {
- enumerateFromParent(pentry.th32ProcessID);
- killProcess(pentry.th32ProcessID);
- }
- }
- }
- CloseHandle(hndl);
-}
-
-int main(int argc, char* argv[])
-{
- QStringList args;
- //argv[0] is allways "x2gohelper.exe"
- for(int i=1; i< argc; ++i)
- {
- args<<argv[i];
- }
- QProcess proc;
- QString executable="x2goclient.exe";
- proc.start(executable, args);
- if(!proc.waitForStarted(4000))
- {
- qCritical()<<"Can't start process";
- return -1;
- }
- DWORD pid=proc.pid()->dwProcessId;
- while(!proc.waitForFinished(300))
- {
- QString err=proc.readAllStandardError();
- QString out=proc.readAllStandardOutput();
- std::cerr<<err.toStdString();
- std::cout<<out.toStdString();
- }
- enumerateFromParent(pid);
- return 0;
-}
diff --git a/x2gohelper/x2gohelper.pro b/x2gohelper/x2gohelper.pro
deleted file mode 100644
index 1ac685e..0000000
--- a/x2gohelper/x2gohelper.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-######################################################################
-# Automatically generated by qmake (2.01a) Di. Jul 8 10:58:26 2014
-######################################################################
-
-TEMPLATE = app
-TARGET =
-DEPENDPATH += .
-INCLUDEPATH += .
-
-# Input
-SOURCES += x2gohelper.cpp
-QT -= gui
-CONFIG += static release
-#CONFIG += console
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git
More information about the x2go-commits
mailing list