[X2Go-Commits] [x2goclient] 01/01: Start x2gohelper from X2Go Client. Revert name changing of X2Go Client and x2gohelper

git-admin at x2go.org git-admin at x2go.org
Fri Jul 11 10:04:17 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 24c27245242808c09bc8083e88e7bbf051647be9
Author: Oleksandr Shneyder <o.shneyder at phoca-gmbh.de>
Date:   Fri Jul 11 10:04:08 2014 +0200

    Start x2gohelper from X2Go Client. Revert name changing of X2Go Client and x2gohelper
---
 config_win.bat            |    3 +--
 debian/changelog          |    2 ++
 onmainwindow.cpp          |    7 +++----
 x2goclient.pro            |    2 --
 x2gohelper/x2gohelper.cpp |   47 +++++++++++++++++++++++----------------------
 x2gohelper/x2gohelper.pro |   14 --------------
 6 files changed, 30 insertions(+), 45 deletions(-)

diff --git a/config_win.bat b/config_win.bat
index 8bd1f36..a96af19 100755
--- a/config_win.bat
+++ b/config_win.bat
@@ -3,6 +3,5 @@ lrelease x2goclient.pro
 set X2GO_CLIENT_TARGET=
 qmake
 cd x2gohelper
-mingw32-make distclean
-qmake
+mingw32-make clean
 cd ..
diff --git a/debian/changelog b/debian/changelog
index 9b5ecfa..25a6049 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,8 @@ x2goclient (4.0.3.0-0x2go1) UNRELEASED; urgency=low
       X2Go Client crashes. (Fixes: #525).
     - On Windows rename x2goclient.exe to x2goclient-mainprocess.exe and
       x2gohelper.exe to x2goclient.exe.
+    - Start x2gohelper from X2Go Client. Revert name changing of X2Go Client and
+      x2gohelper
 
   [ Mike DePaulo ]
   * New upstream release (4.0.3.0):
diff --git a/onmainwindow.cpp b/onmainwindow.cpp
index 8390cbe..8acec61 100644
--- a/onmainwindow.cpp
+++ b/onmainwindow.cpp
@@ -430,12 +430,11 @@ ONMainWindow::ONMainWindow ( QWidget *parent ) :QMainWindow ( parent )
     }
 
 #ifdef Q_OS_WIN
+    QProcess::startDetached("x2gohelper.exe "+QString::number(GetCurrentProcessId()));
     QTimer::singleShot ( 500, this, SLOT ( startWinServers() ) );
-
 #endif
 
 
-
     mainL->setSpacing ( 0 );
     mainL->setMargin ( 0 );
     mainL->insertWidget ( 0, bgFrame );
@@ -9842,11 +9841,11 @@ void ONMainWindow::startPulsed()
     ever ship 1.1 again.
     */
     if (QSysInfo::WindowsVersion == QSysInfo::WV_XP ||
-        QSysInfo::WindowsVersion == QSysInfo::WV_2003 )
+            QSysInfo::WindowsVersion == QSysInfo::WV_2003 )
     {
         x2goDebug<<"Windows XP or Server 2003 (R2) detected.";
         x2goDebug<<"Setting PulseAudio to \"Normal\" CPU priority.";
-            pulseArgs<<"--high-priority=no";
+        pulseArgs<<"--high-priority=no";
     }
 #else
     pulseArgs<<"--exit-idle-time=-1"<<"-n"<<"-F"<<pulseDir+"/config.pa";
diff --git a/x2goclient.pro b/x2goclient.pro
index 386b6aa..99d0fb7 100755
--- a/x2goclient.pro
+++ b/x2goclient.pro
@@ -182,8 +182,6 @@ win32-* {
 	message(building $$TARGET for windows without ldap and cups)
 	LIBS += -lwinspool -lws2_32
 	CONFIG += static release
-	TARGET = x2goclient-mainprocess
-
 }
 QT += svg network
 ICON = icons/x2go-mac.icns
diff --git a/x2gohelper/x2gohelper.cpp b/x2gohelper/x2gohelper.cpp
index d12214c..3a90e44 100644
--- a/x2gohelper/x2gohelper.cpp
+++ b/x2gohelper/x2gohelper.cpp
@@ -14,15 +14,9 @@
 *   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);
@@ -42,7 +36,7 @@ void enumerateFromParent(DWORD pid)
     HANDLE hndl=CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
     if(hndl==INVALID_HANDLE_VALUE)
     {
-        qCritical()<<"failed to get system snapshot";
+        //Failed to get system snapshot
         return;
     }
     PROCESSENTRY32 pentry;
@@ -53,6 +47,11 @@ void enumerateFromParent(DWORD pid)
         {
             if(pid==pentry.th32ParentProcessID)
             {
+                if(pentry.th32ProcessID == GetCurrentProcessId())
+                {
+                    //skip own process
+                    continue;
+                }
                 enumerateFromParent(pentry.th32ProcessID);
                 killProcess(pentry.th32ProcessID);
             }
@@ -63,28 +62,30 @@ void enumerateFromParent(DWORD pid)
 
 int main(int argc, char* argv[])
 {
-    QStringList args;
-    //argv[0] is allways "x2gohelper.exe"
-    for(int i=1; i< argc; ++i)
+    if(argc!=2)
     {
-        args<<argv[i];
+        //wrong number of arguments
+        return -1;
     }
-    QProcess proc;
-    QString executable="x2goclient-mainprocess.exe";
-    proc.start(executable, args);
-    if(!proc.waitForStarted(4000))
+
+    DWORD pid=atoi(argv[1]);
+    if(!pid)
     {
-        qCritical()<<"Can't start process";
+        //error converting argument to int;
         return -1;
     }
-    DWORD pid=proc.pid()->dwProcessId;
-    while(!proc.waitForFinished(300))
+
+    HANDLE handle=OpenProcess(SYNCHRONIZE,0,pid);
+    if(!handle)
     {
-        QString err=proc.readAllStandardError();
-        QString out=proc.readAllStandardOutput();
-        std::cerr<<err.toStdString();
-        std::cout<<out.toStdString();
+        //error open process
+        return -1;
+    }
+    //waiting for process to finish
+    if(WaitForSingleObject(handle,INFINITE)!=WAIT_FAILED)
+    {
+        enumerateFromParent(pid);
     }
-    enumerateFromParent(pid);
+    CloseHandle(handle);
     return 0;
 }
diff --git a/x2gohelper/x2gohelper.pro b/x2gohelper/x2gohelper.pro
deleted file mode 100644
index f30508b..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 = x2goclient
-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