History

Fix sending URL to second interface instance

Ryan Huffman committed 10 years ago

Commit fe4c1611 parent c1e114c1 file · +11 −7Browse files

Showing the changes to interface/src/main.cpp (1 of 1 file). Show all

Unified · Split

interface/src/main.cpp+11−7
@@ -78,8 +78,11 @@ int main(int argc, const char* argv[]) { · 77 unmodified lines
7878 if (parser.isSet(urlOption)) {
7979 QUrl url = QUrl(parser.value(urlOption));
8080 if (url.isValid() && url.scheme() == HIFI_URL_SCHEME) {
81+ qDebug() << "Writing URL to local socket";
8182 socket.write(url.toString().toUtf8());
82− socket.waitForBytesWritten(5000);
83+ if (!socket.waitForBytesWritten(5000)) {
84+ qDebug() << "Error writing URL to local socket";
85+ }
8386 }
8487 }
8588
@@ -95,12 +98,6 @@ int main(int argc, const char* argv[]) { · 9 unmodified lines
9598 #endif
9699 }
97100
98− // Setup local server
99− QLocalServer server;
100−
101− // We failed to connect to a local server, so we remove any existing servers.
102− server.removeServer(applicationName);
103− server.listen(applicationName);
104101
105102 QElapsedTimer startupTime;
106103 startupTime.start();
@@ -125,6 +122,13 @@ int main(int argc, const char* argv[]) { · 18 unmodified lines
125122 QSettings::setDefaultFormat(QSettings::IniFormat);
126123 Application app(argc, const_cast<char**>(argv), startupTime);
127124
125+ // Setup local server
126+ QLocalServer server { &app };
127+
128+ // We failed to connect to a local server, so we remove any existing servers.
129+ server.removeServer(applicationName);
130+ server.listen(applicationName);
131+
128132 QObject::connect(&server, &QLocalServer::newConnection, &app, &Application::handleLocalServerConnection);
129133
130134 QTranslator translator;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t