mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix crash due to passing args
This commit is contained in:
parent
cfe1867d4a
commit
694fedc662
@ -29,8 +29,6 @@ int main(int argc, char * argv[])
|
||||
{
|
||||
int result;
|
||||
#ifdef VCMI_IOS
|
||||
argcForClient = argc;
|
||||
argvForClient = argv;
|
||||
{
|
||||
#endif
|
||||
QApplication vcmilauncher(argc, argv);
|
||||
@ -51,13 +49,13 @@ void startGame(const QStringList & args)
|
||||
|
||||
#ifdef Q_OS_IOS
|
||||
argcForClient = args.size() + 1; //first argument is omitted
|
||||
argvForClient = new char*[argcForClient];
|
||||
argvForClient = new char*[argcForClient];
|
||||
argvForClient[0] = "vcmiclient";
|
||||
for(int i = 1; i < argcForClient; ++i)
|
||||
{
|
||||
const char * s = args[i - 1].toLocal8Bit().constData();
|
||||
argvForClient[i] = new char[strlen(s)];
|
||||
strcpy(argvForClient[i], s);
|
||||
std::string s = args.at(i - 1).toStdString();
|
||||
argvForClient[i] = new char[s.size() + 1];
|
||||
strcpy(argvForClient[i], s.c_str());
|
||||
}
|
||||
qApp->quit();
|
||||
#else
|
||||
|
@ -12,8 +12,6 @@
|
||||
void startGame(const QStringList & args);
|
||||
|
||||
#ifdef VCMI_IOS
|
||||
extern int argcForClient;
|
||||
extern char** argvForClient;
|
||||
extern "C" void launchGame(int argc, char * argv[]);
|
||||
#else
|
||||
void startExecutable(QString name, const QStringList & args);
|
||||
|
@ -207,7 +207,7 @@ void CVCMIServer::establishRemoteConnections()
|
||||
int port = cmdLineOptions["lobby-port"].as<ui16>();
|
||||
logGlobal->info("Server is connecting to remote at %s:%d with uuid %d times", address, port, uuid, numOfConnections);
|
||||
|
||||
for(int i = 0; i < numOfConnections; ++i)
|
||||
for(int i = 0; i < numOfConnections && i == remotePipeConnections; ++i, ++remotePipeConnections)
|
||||
connectToRemote(address, port);
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ class CVCMIServer : public LobbyInfo
|
||||
boost::recursive_mutex mx;
|
||||
std::shared_ptr<CApplier<CBaseForServerApply>> applier;
|
||||
std::unique_ptr<boost::thread> announceLobbyThread, remoteConnectionsThread;
|
||||
int remotePipeConnections = 0;
|
||||
|
||||
public:
|
||||
std::shared_ptr<CGameHandler> gh;
|
||||
|
Loading…
Reference in New Issue
Block a user