process receives a SIGSEGV on Fedora 29
Hello @cmauri,
I'm trying to make eviacam work on Fedora 29, but when building from source using the latest v2.1.3 tag the process receives a SIGSEGV and gets killed.
$ ./src/eviacam --debug
DEBUG: Opened device 'video0' successfully (handle = 1)
DEBUG: Getting device information for handle 1 ...
DEBUG: { shortName = 'video0', name = 'Integrated Camera: Integrated C', driver = 'uvcvideo', location = 'usb-0000:00:14.0-8', vid = 04f2, pid = b5c1, bcd = 4 }
DEBUG: Getting control information for handle 1 ...
DEBUG: Control found: Brightness
DEBUG: { id = 1, name = 'Brightness', type = 6, flags = 3
DEBUG: , min = 0, max = 255, def = 128, step = 1
DEBUG: }
DEBUG: Control found: Contrast
DEBUG: { id = 2, name = 'Contrast', type = 6, flags = 3
DEBUG: , min = 0, max = 255, def = 32, step = 1
DEBUG: }
DEBUG: Control found: Saturation
DEBUG: { id = 4, name = 'Saturation', type = 6, flags = 3
DEBUG: , min = 0, max = 100, def = 64, step = 1
DEBUG: }
DEBUG: Control found: Hue
DEBUG: { id = 5, name = 'Hue', type = 6, flags = 3
DEBUG: , min = -180, max = 180, def = 0, step = 1
DEBUG: }
DEBUG: Control found: White Balance Temperature, Auto
DEBUG: { id = 9, name = 'White Balance Temperature, Auto', type = 2, flags = 3
DEBUG: , min = 0, max = 1, def = 1, step = 1
DEBUG: }
DEBUG: Control found: Gamma
DEBUG: { id = 6, name = 'Gamma', type = 6, flags = 3
DEBUG: , min = 90, max = 150, def = 120, step = 1
DEBUG: }
DEBUG: Control found: Power Line Frequency
DEBUG: { id = 13, name = 'Power Line Frequency', type = 3, flags = 3
DEBUG: , choice = {
DEBUG: 'Disabled'[0]
DEBUG: '50 Hz'[1]
DEBUG: '60 Hz'[2]
DEBUG: }
DEBUG: }
DEBUG: Control found: White Balance Temperature
DEBUG: { id = 8, name = 'White Balance Temperature', type = 6, flags = 3
DEBUG: , min = 2800, max = 6500, def = 4000, step = 1
DEBUG: }
DEBUG: Control found: Sharpness
DEBUG: { id = 7, name = 'Sharpness', type = 6, flags = 3
DEBUG: , min = 0, max = 7, def = 2, step = 1
DEBUG: }
DEBUG: Control found: Backlight Compensation
DEBUG: { id = 12, name = 'Backlight Compensation', type = 6, flags = 3
DEBUG: , min = 0, max = 2, def = 1, step = 1
DEBUG: }
DEBUG: Control found: Exposure, Auto
DEBUG: { id = 15, name = 'Exposure, Auto', type = 3, flags = 3
DEBUG: , choice = {
DEBUG: 'Manual Mode'[1]
DEBUG: 'Aperture Priority Mode'[3]
DEBUG: }
DEBUG: }
DEBUG: Control found: Exposure (Absolute)
DEBUG: { id = 17, name = 'Exposure (Absolute)', type = 6, flags = 3
DEBUG: , min = 4, max = 1250, def = 156, step = 1
DEBUG: }
DEBUG: Control found: Exposure, Auto Priority
DEBUG: { id = 16, name = 'Exposure, Auto Priority', type = 2, flags = 3
DEBUG: , min = 0, max = 1, def = 0, step = 1
DEBUG: }
DEBUG: Closed device 'video0' (handle = 0)
DEBUG: Opened device 'video1' successfully (handle = 2)
DEBUG: Getting device information for handle 2 ...
DEBUG: { shortName = 'video1', name = 'Integrated Camera: Integrated C', driver = 'uvcvideo', location = 'usb-0000:00:14.0-8', vid = 04f2, pid = b5c1, bcd = 4 }
DEBUG: Getting control information for handle 2 ...
DEBUG: No controls found (ret = 0).
DEBUG: Closed device 'video1' (handle = 0)
INFO: Previous used camera: (Id:0) Integrated Camera: Integrated C...
INFO: FOUND
INFO: Detected 2 camera(s)
INFO: Selected camera: 0
INFO: Try to open the camera to make sure it works...
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
VIDEOIO ERROR: V4L: device /dev/video1: Unable to query number of channels
warning: Cannot query video position: status=0 value=-1 duration=-1
(/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:952)
VIDEOIO ERROR: V4L: index 2 is not correct!
warning: Cannot query video position: status=0 value=-1 duration=-1
(/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:952)
VIDEOIO ERROR: V4L: index 3 is not correct!
warning: Cannot query video position: status=0 value=-1 duration=-1
(/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:952)
VIDEOIO ERROR: V4L: index 4 is not correct!
warning: Cannot query video position: status=0 value=-1 duration=-1
(/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:952)
VIDEOIO ERROR: V4L: index 5 is not correct!
warning: Cannot query video position: status=0 value=-1 duration=-1
(/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:952)
VIDEOIO ERROR: V4L: index 6 is not correct!
warning: Cannot query video position: status=0 value=-1 duration=-1
(/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:952)
VIDEOIO ERROR: V4L: index 7 is not correct!
warning: Cannot query video position: status=0 value=-1 duration=-1
(/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:952)
VIDEOIO ERROR: V4L: index 8 is not correct!
warning: Cannot query video position: status=0 value=-1 duration=-1
(/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:952)
VIDEOIO ERROR: V4L: index 9 is not correct!
warning: Cannot query video position: status=0 value=-1 duration=-1
(/builddir/build/BUILD/opencv-3.4.1/modules/videoio/src/cap_gstreamer.cpp:952)
Segmentation fault (core dumped)
The problem is in the call to DisplayHeight() in CMouseControl::GetScreenSize():
$ gdb ./src/eviacam
...
Thread 1 "eviacam" received signal SIGSEGV, Segmentation fault.
0x0000000000477f5d in CMouseControl::GetScreenSize (this=this@entry=0xebae10) at mousecontrol.cpp:136
136 m_ScreenHeight=
(gdb) bt
#0 0x0000000000477f5d in CMouseControl::GetScreenSize() (this=this@entry=0xebae10) at mousecontrol.cpp:136
#1 0x00000000004780a9 in CMouseControl::OnDisplayChanged() (this=this@entry=0xebae10) at mousecontrol.cpp:174
#2 0x0000000000478108 in CMouseControl::CMouseControl(void*) (this=0xebae10, pDisplay=<optimized out>) at mousecontrol.cpp:102
#3 0x000000000046ffc6 in CPointerAction::CPointerAction() (this=0x1115640) at pointeraction.cpp:39
#4 0x000000000043c1f0 in CViacamController::Initialize() (this=this@entry=0xd35e00) at viacamcontroller.cpp:317
#5 0x0000000000435617 in EViacamApp::OnInit() (this=0x9fb230) at eviacamapp.cpp:176
#6 0x00007ffff7390d32 in wxEntry(int&, wchar_t**) (argc=<optimized out>, argv=<optimized out>) at ../include/wx/init.h:109
#7 0x0000000000422c52 in main(int, char**) (argc=<optimized out>, argv=0x7fffffffd1e8) at eviacamapp.cpp:81
...
(gdb) list
131 if (!retval) { exit (-1); }
132
133 m_ScreenHeight= devMode.dmPelsHeight;
134 m_ScreenWidth= devMode.dmPelsWidth;
135 #else // Linux
136 m_ScreenHeight=
137 DisplayHeight (static_cast<Display*>(m_pDisplay), DefaultScreen (static_cast<Display*>(m_pDisplay)));
138 m_ScreenWidth=
139 DisplayWidth (static_cast<Display*>(m_pDisplay), DefaultScreen (static_cast<Display*>(m_pDisplay)));
140 #endif
...
(gdb) print m_pDisplay
$6 = (void *) 0xa8a000
(gdb) print m_ScreenHeight
$7 = 0
(gdb) print m_ScreenWidth
$8 = 0
I see that m_pDisplay is set though, to the pDisplay argument received by the CMouseControl::CMouseControl() constructor:
$ gdb ./src/eviacam
...
(gdb) break CMouseControl
Breakpoint 1 at 0x4780c0: file mousecontrol.cpp, line 79.
(gdb) run
...
Thread 1 "eviacam" hit Breakpoint 1, CMouseControl::CMouseControl (this=0xc34de0, pDisplay=0xa8a800) at mousecontrol.cpp:79
79 CMouseControl::CMouseControl (void* pDisplay)
(gdb) print pDisplay
$1 = (void *) 0xa8a800
(gdb) continue
Continuing.
Thread 1 "eviacam" received signal SIGSEGV, Segmentation fault.
0x0000000000477f5d in CMouseControl::GetScreenSize (this=this@entry=0xc34de0) at mousecontrol.cpp:143
143 m_ScreenHeight=
(gdb) print m_pDisplay
$2 = (void *) 0xa8a800
So I don't really understand why DisplayHeight() causes a NULL pointer deference since m_pDisplay seems to be set correctly.
Maybe is a red herring, but I'm using Wayland + XWayland for X clients. Do you know if eviacam is supposed to work on this setup or should only under X?
In case is useful, the wxWidgets backend is GTK3.
$ wx-config --selected-config
gtk3-unicode-3.0
Any hints on how to further debug this?
Hi @martinezjavier,
Certainly, I never tried eViacam on Wayland, thus not sure about its compatibility.
eViacam uses some "low-level" Xlib calls to work. Just guessing, but perhaps these calls to DefaultScreen and DisplayHeight and DisplayWidth, and/or the Display* type castings do not work under Wayland as expected. I suggest checking how the Display type is defined in both cases and whether these functions are supported on Wayland. Hope it helps.