segmentation-fault

WARNING: QApplication was not created in main() thread

浪子不回头ぞ 提交于 2019-12-11 07:59:21
问题 When I try to develop a parallel python application using the ~threading module~, I get the following error Python Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)" I'm using python 3.6 ,Linux 16.04 and Pycharm 2018 I cannot understand the reason and how to fix it. Code Sample: numOfThread = 8 class myThread (threading.Thread): def __init__(self, thread_id, name, frames): threading.Thread.__init__(self) self.thread_id = thread_id self.name = name self.frames = frames

Printing char array in C causes segmentation fault

梦想与她 提交于 2019-12-11 07:44:38
问题 I did a lot of searching around for this, couldn't find any question with the same exact issue. Here is my code: void fun(char* name){ printf("%s",name); } char name[6]; sscanf(input,"RECTANGLE_SEARCH(%6[A-Za-z0-9])",name) printf("%s",name); fun(name); The name is grabbed from scanf , and it printed out fine at first. Then when fun is called, there is a segmentation fault when it tries to print out name. Why is this? 回答1: After looking in my scrying-glass, I have it: Your scanf did overflow

Program received signal SIGSEGV, Segmentation fault. C++ LIST

杀马特。学长 韩版系。学妹 提交于 2019-12-11 07:35:07
问题 L.insert() gives segmentation fault if I call it after L.deleteElement() . This is the error message: 196 nPtr = (nodePtr)malloc(sizeof(node)); (gdb) print(c) $7 = 2 (gdb) next 197 if(nPtr!=NULL){ (gdb) print(nPtr) $8 = (nodePtr) 0x615c70 (gdb) next 198 nPtr->data = element; (gdb) print(element) $9 = "(" (gdb) next Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7b74413 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11:

Calling ServiceStack.Text.JsConfig.RegisterTypeForAot<T>(); with MonoTouch causes SIGSEGV on startup on device

社会主义新天地 提交于 2019-12-11 07:31:44
问题 I've been trying to use ServiceStack.Text.JsConfig.RegisterTypeForAot(); in an method that is not used at runtime to cure my AOT issues but have run into other weird issues when I have too many calls to it. I've got 10 calls to various types including classes, structs and enums. When I have 9 calls everything works fine, I've shuffled some of the types around so I'm pretty sure it is the number. When I have 10 calls I get ... Stacktrace: at System.MonoType.ToString () [0x00000] in /Developer

How to change this app to disable input from command line?

[亡魂溺海] 提交于 2019-12-11 07:29:18
问题 This is the Original code: #include <stdio.h> #include <string.h> #include <assert.h> #if defined(_WIN32) && !defined(__CYGWIN__) #include <windows.h> #else #include <sys/select.h> #endif #include <sphinxbase/err.h> #include <sphinxbase/ad.h> #include "pocketsphinx.h" static const arg_t cont_args_def[] = { POCKETSPHINX_OPTIONS, /* Argument file. */ {"-argfile", ARG_STRING, NULL, "Argument file giving extra arguments."}, {"-adcdev", ARG_STRING, NULL, "Name of audio device to use for input."},

Why am I getting a segfault on cin?

走远了吗. 提交于 2019-12-11 07:16:49
问题 I am writing a fairly simple exercise (homework), and most of it works, however it sometimes segfaults on cin. Here is the relevant code. int main() { std::string str = ""; std::cout << "Please select the desired operation:\n"; std::cout << "(A): Generate Decompositions\n"; std::cout << "(B): Generate Acceptable Compositions from S1.txt and S2.txt\n"; std::cout << "cout"; //debug statement std::cin >> str; std::cout << "cin"; //debug statement std::cout << str; char resp = str.at(0); std:

Smart answer needed for strange segmentation fault on embedded ARM with posix threads

谁说我不能喝 提交于 2019-12-11 07:09:46
问题 The last couple of days I've been working on a strange segmentation fault. The following code works just fine on my PC running Linux. But using the ARM crosscompiler suppplied by the manufactor of our embedded device, it gives a segmentation fault in routine s(). The SIGSEGV occurs at the destruction of a std::string. This also happens if you pass it as a variable. However, with non STL classes (e.g. int) it all works fine. The code is compiled using an ARM cross compiler arm-linux-g++ -Wall

C for loop segmentation fault

二次信任 提交于 2019-12-11 06:55:58
问题 I am getting a segmentation fault error when I try to compile this code on gcc. #include <stdio.h> #include <stdlib.h> #define N_TIMES 600000 #define ARRAY_SIZE 10000 int main (void) { double *array = calloc(ARRAY_SIZE, sizeof(double)); double sum = 0; int i; double sum1 = 0; for (i = 0; i < N_TIMES; i++) { int j; for (j = 0; j < ARRAY_SIZE; j += 20) { sum += array[j] + array[j+1] + array[j+2] + array[j+3] + array[j+4] + array[j+5] + array[j+6] + array[j+7] + array[j+8] + array[j+9]; sum +=

C chat program get an error Segmentation fault (core dumped)

你离开我真会死。 提交于 2019-12-11 06:47:02
问题 I am building a chat program between a client and a server in C language. Client will connect to server, sends to it a message. Then server will response that meesage. If there is another client connects to server, the new connection will be created a new thread. So I use pthread.h to build a multi-threaded chat program in C. Please see the server.c and client.c code below to get more details. server.c #include <pthread.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h>

assigning value from a vector (of shared pointer) to a shared pointer cause segmentation fault c++

≡放荡痞女 提交于 2019-12-11 06:19:05
问题 In my code, I have a vector <vector <vector <vector <std::tr1::shared_ptr<foo> > > > > named foosBoxes . The nested vector has a role of simulating a physical boxes position. I also have a while loop which cause a segmentation fault: vector<std::tr1::shared_ptr<foo> >::iterator fooit = foosBoxes[x][y][z].begin(); //x,y,z are valid integer std::tr1::shared_ptr<foo> aFoo; while (fooit != foosBoxes[x][y][z].end()){ aFoo = *fooit; //this cause segmentation fault fooit++; //some stuff which does