On Friday 07 February 2014 17:25:27 Patrick Shirkey wrote:
> On Sat, February 8, 2014 1:01 am, Christian Schoenebeck wrote:
> > On Friday 07 February 2014 08:54:53 Patrick Shirkey wrote:
> >> It compiles fine for me on debian-7.0 64bit. However it crashes on start
> > 
> >> and I get this backtrace:
> > Does the attached patch fix it?
> 
> Moves it slightly but looks to be the same error.  I'm running lscp on a
> headless machine via ssh terminal in case that has any influence.

No, that's irrelevant.

It rather seems static variables of the application are initialized in a 
different order on your machine, but that order can be different on any 
system. Try the attached patch, it should fix it.

CU
Christian
Index: src/shell/lscp.cpp
===================================================================
--- src/shell/lscp.cpp	(revision 2516)
+++ src/shell/lscp.cpp	(working copy)
@@ -27,8 +27,8 @@
 using namespace std;
 using namespace LinuxSampler;
 
-static LSCPClient g_client;
-static KeyboardReader g_keyboardReader;
+static LSCPClient* g_client = NULL;
+static KeyboardReader* g_keyboardReader = NULL;
 static Condition g_todo;
 static String g_goodPortion;
 static String g_badPortion;
@@ -66,7 +66,7 @@
     // now add the suggested, correct characters
     s += g_suggestedPortion;
     g_suggestedPortion.clear();
-    g_client.send(s);
+    g_client->send(s);
 }
 
 int main(int argc, char *argv[]) {
@@ -103,12 +103,13 @@
 
     // try to connect to the sampler's LSCP server and start a thread for
     // receiving incoming network data from the sampler's LSCP server
-    g_client.setCallback(onLSCPClientNewInputAvailable);
-    if (!g_client.connect(host, port)) return -1;
-    String sResponse = g_client.sendCommandSync(
+    g_client = new LSCPClient;
+    g_client->setCallback(onLSCPClientNewInputAvailable);
+    if (!g_client->connect(host, port)) return -1;
+    String sResponse = g_client->sendCommandSync(
         (autoCorrect) ? "SET SHELL AUTO_CORRECT 1" : "SET SHELL AUTO_CORRECT 0"
     );
-    sResponse = g_client.sendCommandSync("SET SHELL INTERACT 1");
+    sResponse = g_client->sendCommandSync("SET SHELL INTERACT 1");
     if (sResponse.substr(0, 2) != "OK") {
         cerr << "Error: sampler too old, it does not support shell instructions\n";
         return -1;
@@ -117,8 +118,9 @@
     // start a thread for reading from the local text input keyboard
     // (keyboard echo will be disabled as well to have a clean control on what
     // is appearing on the screen)
-    g_keyboardReader.setCallback(onNewKeyboardInputAvailable);
-    g_keyboardReader.startReading();
+    g_keyboardReader = new KeyboardReader;
+    g_keyboardReader->setCallback(onNewKeyboardInputAvailable);
+    g_keyboardReader->startReading();
     
     // main thread's loop
     while (true) {
@@ -129,8 +131,8 @@
         g_todo.Unlock();
 
         // did network data arrive?
-        while (g_client.messageComplete()) {
-            String line = *g_client.popLine();
+        while (g_client->messageComplete()) {
+            String line = *g_client->popLine();
             //printf("line '%s'\n", line.c_str());
             if (line.substr(0,4) == "SHU:") {
                 int code = 0, n = 0;
@@ -211,13 +213,13 @@
                 cout << line.substr(0,3) << flush;
                 cfmt.reset();
                 cout << line.substr(3) << endl << flush;
-            } else if (g_client.multiLine()) { // multi-line response expected ...
+            } else if (g_client->multiLine()) { // multi-line response expected ...
                 cout << endl << flush;
                 while (true) {                   
                    cout << line << endl << flush;
                    if (line.substr(0, 1) == ".") break;
-                   if (!g_client.lineAvailable()) break;
-                   line = *g_client.popLine();
+                   if (!g_client->lineAvailable()) break;
+                   line = *g_client->popLine();
                 }
             } else {
                 cout << endl << line << endl << flush;
@@ -225,8 +227,8 @@
         }
 
         // did keyboard input arrive?
-        while (g_keyboardReader.charAvailable()) {
-            char c = g_keyboardReader.popChar();
+        while (g_keyboardReader->charAvailable()) {
+            char c = g_keyboardReader->popChar();
 
             CFmt cfmt;
             cfmt.white();
@@ -241,7 +243,7 @@
                 cout << c << flush;
             }
 
-            g_client.send(c);
+            g_client->send(c);
         }
     }
 
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Linuxsampler-devel mailing list
Linuxsampler-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxsampler-devel

Reply via email to