[Jderobot-dev] Violacion de segmento
Eloy
abanibiaboebe en gmail.com
Dom Feb 24 17:11:44 CET 2013
Hola, me ha aparecido un problema pero no se donde puede estar.
La traza que me sale usando gdb es:
(gdb) run
Starting program:
/home/eloy/tfm/trunk/eloyBasicComponent/eloyBasicComponent
--Ice.Config=eloyBasicComponent.cfg
[Depuración de hilo usando libthread_db enabled]
[Nuevo Thread 0xb7fc3b70 (LWP 18015)]
[Nuevo Thread 0xb77c2b70 (LWP 18016)]
[Nuevo Thread 0xb6fc1b70 (LWP 18017)]
[Nuevo Thread 0xb67c0b70 (LWP 18018)]
[Nuevo Thread 0xb5fbfb70 (LWP 18019)]
Program received signal SIGSEGV, Segmentation fault.
[Cambiando a Thread 0xb5fbfb70 (LWP 18019)]
0x00dcf1e8 in ?? () from /usr/lib/libgdk-x11-2.0.so.0
(gdb) *
*
Estoy con basic_component toqueteando, al pasar la imagen a la API tanto en
el hilo del gui como en el de control, cojo y suelto el mutex de la api.
Usando Valgrind me aparece:
eloy en ubuntoy:~/tfm/trunk/eloyBasicComponent$ valgrind ./eloyBasicComponent
--Ice.Config=eloyBasicComponent.cfg
==19043== Memcheck, a memory error detector
==19043== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al.
==19043== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for
copyright info
==19043== Command: ./eloyBasicComponent --Ice.Config=eloyBasicComponent.cfg
==19043==
==19043== Thread 6:
==19043== Invalid read of size 1
==19043== at 0x4CE91E8: ??? (in /usr/lib/libgdk-x11-2.0.so.0.2000.1)
==19043== by 0x4CECC03: ??? (in /usr/lib/libgdk-x11-2.0.so.0.2000.1)
==19043== by 0x4CED01D: gdk_draw_rgb_image_dithalign (in
/usr/lib/libgdk-x11-2.0.so.0.2000.1)
==19043== by 0x4CD761D: ??? (in /usr/lib/libgdk-x11-2.0.so.0.2000.1)
==19043== by 0x4D0C756: ??? (in /usr/lib/libgdk-x11-2.0.so.0.2000.1)
==19043== by 0x4CFA978: ??? (in /usr/lib/libgdk-x11-2.0.so.0.2000.1)
==19043== by 0x4CD5B1E: gdk_draw_pixbuf (in
/usr/lib/libgdk-x11-2.0.so.0.2000.1)
==19043== by 0x48D2BD4: ??? (in /usr/lib/libgtk-x11-2.0.so.0.2000.1)
==19043== by 0x44DF440:
Gtk::Widget_Class::expose_event_callback(_GtkWidget*, _GdkEventExpose*) (in
/usr/lib/libgtkmm-2.4.so.1.1.0)
==19043== by 0x48F7433: ??? (in /usr/lib/libgtk-x11-2.0.so.0.2000.1)
==19043== by 0x4FC68B8: ??? (in /usr/lib/libgobject-2.0.so.0.2400.1)
==19043== by 0x4FC8177: g_closure_invoke (in
/usr/lib/libgobject-2.0.so.0.2400.1)
==19043== Address 0xb395a12 is 10 bytes inside a block of size 259,224
free'd
==19043== at 0x4025B3A: free (vg_replace_malloc.c:366)
==19043== by 0x5180AA1: cv::fastFree(void*) (in
/usr/local/lib/libopencv_core.so.2.3.1)
==19043== by 0x804FEA7: cv::Mat::operator=(cv::Mat const&) (in
/home/eloy/tfm/trunk/eloyBasicComponent/eloyBasicComponent)
==19043== by 0x804ED06:
eloyBasicComponent::Control::setImg2Gui(eloyBasicComponent::Api*) (in
/home/eloy/tfm/trunk/eloyBasicComponent/eloyBasicComponent)
==19043== by 0x804EB6B:
eloyBasicComponent::Control::UpdateSensorsICE(eloyBasicComponent::Api*) (in
/home/eloy/tfm/trunk/eloyBasicComponent/eloyBasicComponent)
De la traza supongo que es en la funcion setImg2Gui:
void Control::setImg2Gui(Api *api){
pthread_mutex_lock(&api->controlGui);
//Copio imagen de entrada al gui
api->cvImageDataIn = matOriginal.clone();;
//Hago copia de la matriz y la paso al gui.
api->cvImageDataOut = mat2Edit.clone();
pthread_mutex_unlock(&api->controlGui);
}
api->cvImageDataIn y api->cvImageDataOut son cv::Mat las cuales uso para
mostrar por el gui las imagenes.
A alguno os ha pasado algo parecido?
Os pongo el codigo del hilo de control
namespace eloyBasicComponent {
cv::Mat matOriginal;
//Image to do things
cv::Mat mat2Edit;
//Image input
cv::Mat imgIn;
//Image output
cv::Mat imgOut;
Control::~Control() {}
void Control::UpdateSensorsICE(Api *api) {
//Obtengo la imagen de la camara
jderobot::ImageDataPtr imageFromIce = this->cprx1->getImageData();
//Matriz original de Ice
matOriginal = cv::Mat(imageFromIce->description->height,
imageFromIce->description->width,
CV_8UC3,
&(imageFromIce->pixelData[0]));
//Matriz de openCv con la imagen de Ice para hacerle tratamientos
mat2Edit = matOriginal.clone();
//grayScale();
setImg2Gui(api);
}
void Control::grayScale(){
//Matriz en grises
cv::Mat greyMat;
//Convierto a grises la imagen de la camara
cvtColor(mat2Edit, greyMat, CV_RGB2GRAY);
//Devuelve la modificacion
imgOut = greyMat;
}
void Control::setImg2Gui(Api *api){
pthread_mutex_lock(&api->controlGui);
//Copio imagen de entrada al gui
api->cvImageDataIn = matOriginal.clone();;
//Hago copia de la matriz y la paso al gui.
imgOut = mat2Edit.clone();
api->cvImageDataOut = mat2Edit.clone();
pthread_mutex_unlock(&api->controlGui);
}
}
Un saludo.
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://gsyc.escet.urjc.es/pipermail/jde-developers/attachments/20130224/7740d7a6/attachment.htm
More information about the Jde-developers
mailing list