[X2Go-Commits] [x2goclient] 02/02: Add x2gohelper to start X2Go Client on Windows and clean child processes if X2Go Client crashes. (Fixes: #525).

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 5bb4a331fed1f1891a9ff176ae4f0221ba4a4c6b
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Tue Jul 8 17:27:59 2014 +0200

    Add x2gohelper to start X2Go Client on Windows and clean child processes if X2Go Client crashes. (Fixes: #525).
---
 config_win.bat   |    5 +++-
 debian/changelog |    2 ++
 ongetpass.cpp    |   78 ------------------------------------------------------
 onmainwindow.cpp |    6 -----
 4 files changed, 6 insertions(+), 85 deletions(-)

diff --git a/config_win.bat b/config_win.bat
index 695b3e2..8bd1f36 100755
--- a/config_win.bat
+++ b/config_win.bat
@@ -2,4 +2,7 @@ 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 f4e8419..8551493 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -53,6 +53,8 @@ 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. (Fixes: #525).
 
   [ Mike DePaulo ]
   * New upstream release (4.0.2.1):
diff --git a/ongetpass.cpp b/ongetpass.cpp
index 3d65b2e..e88cbe5 100644
--- a/ongetpass.cpp
+++ b/ongetpass.cpp
@@ -33,11 +33,8 @@
 #ifndef Q_OS_WIN
 #include <sys/types.h>
 #include <signal.h>
-#else
-#include <iostream>
 #endif
 
-
 #include <QPlastiqueStyle>
 #include <QMessageBox>
 #include <iostream>
@@ -45,54 +42,8 @@
 #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[] )
 {
@@ -150,35 +101,6 @@ 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 05ed0d9..8390cbe 100644
--- a/onmainwindow.cpp
+++ b/onmainwindow.cpp
@@ -6786,12 +6786,6 @@ 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 ( "=" );

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git


More information about the x2go-commits mailing list