This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 1cb911ab6122647f1c399c4cba41fa193aa5c352 Author: Mihai Moldovan <ionic@ionic.de> Date: Thu Jan 14 03:29:01 2016 +0100 onmainwindow.cpp: add some more error handling for parsing the return value of x2golistsessions. As it turns out, it can happen that "invalid" strings are inserted in there, for instance by the perl interpreter itself. We need to skip over these, or the client crashes when splitting up the invalid lines. --- debian/changelog | 5 +++++ src/onmainwindow.cpp | 54 ++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index a3d37fa..185be61 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,11 @@ x2goclient (4.0.5.1-0x2go1) UNRELEASED; urgency=low - onmainwindow.{cpp,h}: don't use a hardcoded path to xmodmap on OS X and handle errors more gracefully. Fixes: #487. - x2goclient.pro: fix typo --stdlib=... -> -stdlib=... Fixes: #973. + - onmainwindow.cpp: add some more error handling for parsing the return + value of x2golistsessions. As it turns out, it can happen that "invalid" + strings are inserted in there, for instance by the perl interpreter + itself. We need to skip over these, or the client crashes when splitting + up the invalid lines. * debian/control: - Change apache2-dev | libc6-dev build dependency back to apache2-dev only. Otherwise, apache2-dev is not installed at all, even though diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 41de685..0b9dfac 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -3582,8 +3582,15 @@ void ONMainWindow::slotListSessions ( bool result,QString output, else { x2goSession s=getSessionFromString (config.sessiondata); - x2goDebug<<"Resuming managed session with ID: " + s.sessionId; - resumeSession ( s ); + + /* Check getSessionFromString for what this "invalid" string means. */ + if (s.agentPid == "invalid") { + startNewSession (); + } + else { + x2goDebug << "Resuming managed session with ID: " + s.sessionId; + resumeSession (s); + } } return; } @@ -3611,14 +3618,17 @@ void ONMainWindow::slotListSessions ( bool result,QString output, else if ( sessions.size() ==1 ) { x2goSession s=getSessionFromString ( sessions[0] ); + QDesktopWidget wd; - if ( s.status=="S" && isColorDepthOk ( wd.depth(), - s.colorDepth ) - &&s.command == selectedCommand ) + + /* Check getSessionFromString for what this "invalid" string means. */ + if ((s.agentPid != "invalid") && (s.status == "S") + && (isColorDepthOk (wd.depth (), s.colorDepth)) + && (s.command == selectedCommand)) resumeSession ( s ); else { - if ( startHidden ) + if ((startHidden) || (s.agentPid == "invalid")) startNewSession(); else selectSession ( sessions ); @@ -3634,10 +3644,13 @@ void ONMainWindow::slotListSessions ( bool result,QString output, { x2goSession s=getSessionFromString ( sessions[i] ); + QDesktopWidget wd; - if ( s.status=="S" && isColorDepthOk ( - wd.depth(),s.colorDepth ) - &&s.command == selectedCommand ) + + /* Check getSessionFromString for what this "invalid" string means. */ + if ((s.agentPid != "invalid") && (s.status == "S") + && (isColorDepthOk (wd.depth (), s.colorDepth)) + && (s.command == selectedCommand)) { resumeSession ( s ); return; @@ -3653,7 +3666,19 @@ void ONMainWindow::slotListSessions ( bool result,QString output, x2goSession ONMainWindow::getSessionFromString ( const QString& string ) { QStringList lst=string.split ( '|' ); + x2goSession s; + + /* + * Skip over invalid sessions strings... + * This can happen if the perl interpreter outputs warning or error messages + * to stdout. + */ + if (lst.size () < 10) { + s.agentPid = "invalid"; + return (s); + } + s.agentPid=lst[0]; s.sessionId=lst[1]; s.display=lst[2]; @@ -4389,6 +4414,11 @@ void ONMainWindow::selectSession ( QStringList& sessions ) x2goDebug<<"Decoding session string:" + sessions[row]; x2goSession s=getSessionFromString ( sessions[row] ); + /* Check getSessionFromString for what this "invalid" string means. */ + if (s.agentPid == "invalid") { + continue; + } + selectedSessions.append ( s ); QStandardItem *item; @@ -7652,8 +7682,10 @@ void ONMainWindow::slotListAllSessions ( bool result,QString output, x2goDebug<<"Will proceed with this session."; QDesktopWidget wd; - if ( s.status=="S" && isColorDepthOk ( - wd.depth(),s.colorDepth ) ) + + /* Check getSessionFromString for what this "invalid" string means. */ + if ((s.agentPid != "invalid") && (s.status == "S") + && (isColorDepthOk (wd.depth (), s.colorDepth))) { resumeSession ( s ); } -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git