PDA

View Full Version : segmentation fault loading an Image



gorka_sm
5th May 2011, 18:17
Hello , I am trying to represent a periodic Image in MythTV 0.22 background using the MythUIImage class.
I have the following Qt code :


MythScreenStack *mainStack = GetMythMainWindow -> GetMainStack;
const QString pila("/home/aido/foto.jpg");
MythScreenType *aux = new MythScreenType(mainStack,pila,true);
pthread_t foto_thread;
mainStack->AddScreen(aux);
int status = pthread_create(&foto_thread,NULL,run_foto_thread,aux)




static void *run_foto_thread(void *data)
{

pthread_t imagen_thread;
QString numero;


QString s1("/home/aido/foto.jpg");
MythScreenType *mnstack =(MyhtScreenType *)data;

MythUIImage *image = new MythUIImage(menstack,s1);

image->SetFilename(s1);
while(true)
{

sleep(1.1);
image->Load(true);

}




The image is represented but I obtained a segmentation fault .I have debugged the code and I obtain the problem is in image->Load(true).
Does anybody know Why can that be ?
Thanks
Gorka



}

mvuori
5th May 2011, 21:12
First of all, you should copy the code exactly as it is -- now it would not even compile (for example: mnstack <> menstack) and people can't tell your typos from the possible bugs.

I don't know anything about MythTV APIs, but if the code works up and untl Load, I suspect this: apparently you try to load an image in the background every second. Perhaps the system doesn't handle it correctly. I'd try changing Load(true) to Load(false) first and seeing what happens. Still, I don't understand what the idea is to load the same image again and again.

gorka_sm
5th May 2011, 22:28
I load the same Image again and again because I want to develop a videoconference based on loading multiple times a file Image which is continously changing and that is the only way I have found.
I have tried to change from true to false and have the same problem
Any other idea ?
Thanks
Gorka