Skip to content

Commit

Permalink
Dev server workaround for processEvents
Browse files Browse the repository at this point in the history
... because handleRequest calls qApp->processEvents
causing all kind of side effects in the standalone
server code (which is based on events) and even
crashes on deleteLater connections.

The original issue was the finish call invoking
plugins on deleted request handlers (not a crash
but still a bug).

This is a workaround while we decide if we can
remove the qApp->processEvents in the main server
handle request routine which has been there for
decades.
  • Loading branch information
elpaso committed May 21, 2020
1 parent 011168f commit 8c76c51
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/qgis_mapserver.cpp
Expand Up @@ -259,7 +259,7 @@ int main( int argc, char *argv[] )
};

// This will delete the connection when disconnected before ready read is called
clientConnection->connect( clientConnection, &QAbstractSocket::disconnected, context, connectionDeleter );
clientConnection->connect( clientConnection, &QAbstractSocket::disconnected, context, connectionDeleter, Qt::QueuedConnection );

// Incoming connection parser
clientConnection->connect( clientConnection, &QIODevice::readyRead, context, [ =, &server, &connCounter ] {
Expand Down Expand Up @@ -380,7 +380,7 @@ int main( int argc, char *argv[] )
if ( clientConnection->state() == QAbstractSocket::SocketState::ConnectedState )
{
clientConnection->connect( clientConnection, &QAbstractSocket::disconnected,
clientConnection, connectionDeleter );
clientConnection, connectionDeleter, Qt::QueuedConnection );
}
else
{
Expand Down Expand Up @@ -450,7 +450,7 @@ int main( int argc, char *argv[] )
clientConnection->disconnectFromHost();
}

} );
}, Qt::QueuedConnection );

} );

Expand Down

0 comments on commit 8c76c51

Please sign in to comment.