Skip to content
Permalink
Browse files
MusPlay: Fixed a broken argument file opening on Windows
  • Loading branch information
Wohlstand committed Apr 9, 2020
1 parent 88ae2cb commit 2052e2f7a9966e904b0d2c046ae3bcb27ed3fd85
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
@@ -47,10 +47,10 @@ void IntProcServer::stateChanged(QAbstractSocket::SocketState stat)

void IntProcServer::doReadData()
{
while (hasPendingDatagrams())
while(hasPendingDatagrams())
{
QByteArray datagram;
datagram.resize((int)pendingDatagramSize());
datagram.resize(static_cast<int>(pendingDatagramSize()));
QHostAddress sender;
quint16 senderPort;
readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
@@ -60,7 +60,7 @@ void IntProcServer::doReadData()

void IntProcServer::displayError(QTcpSocket::SocketError socketError)
{
Q_UNUSED(socketError);
Q_UNUSED(socketError)
qDebug() << QString("SDL2 Mixer X SingleAPP: The following error occurred: %1.").arg(errorString());
}

@@ -37,7 +37,10 @@ SingleApplication::SingleApplication(QStringList &args) :
m_server = nullptr;
QString isServerRuns;

//! is another copy of MusPlay running?
bool isRunning=false;
//! Don't create semaphore listening because another copy of Editor runs
bool forceRun = false;
m_sema.acquire();//Avoid races

if(!m_shmem.create(1))//Detect shared memory copy
@@ -56,7 +59,8 @@ SingleApplication::SingleApplication(QStringList &args) :
if(args.contains("--force-run", Qt::CaseInsensitive))
{
isServerRuns.clear();
isRunning=false;
isRunning = false;
forceRun = true;
args.removeAll("--force-run");
}

@@ -113,13 +117,17 @@ SingleApplication::SingleApplication(QStringList &args) :
{
// The attempt was insuccessful, so we continue the program
m_shouldContinue = true;
m_server = new LocalServer();
m_server->start();
QObject::connect(m_server, SIGNAL(showUp()), this, SLOT(slotShowUp()));
QObject::connect(m_server, SIGNAL(dataReceived(QString)), this, SLOT(slotOpenFile(QString)));
QObject::connect(m_server, SIGNAL(acceptedCommand(QString)), this, SLOT(slotAcceptedCommand(QString)));
QObject::connect(this, SIGNAL(stopServer()), m_server, SLOT(stopServer()));
if(!forceRun)
{
m_server = new LocalServer();
m_server->start();
QObject::connect(m_server, SIGNAL(showUp()), this, SLOT(slotShowUp()));
QObject::connect(m_server, SIGNAL(dataReceived(QString)), this, SLOT(slotOpenFile(QString)));
QObject::connect(m_server, SIGNAL(acceptedCommand(QString)), this, SLOT(slotAcceptedCommand(QString)));
QObject::connect(this, SIGNAL(stopServer()), m_server, SLOT(stopServer()));
}
}

m_sema.release();//Free semaphore
}

@@ -96,8 +96,8 @@ int main(int argc, char *argv[])
#endif

w.show();
if(a.arguments().size()>1)
w.openMusicByArg(a.arguments()[1]);
if(args.size() > 1)
w.openMusicByArg(args[1]);
# ifdef __APPLE__
{
QStringList argx = a.getOpenFileChain();

0 comments on commit 2052e2f

Please sign in to comment.