1From 29665ab1a97bb0ca4b74275f5526e9afe09ccc64 Mon Sep 17 00:00:00 2001
2From: Martin Jansa <Martin.Jansa@gmail.com>
3Date: Tue, 18 Dec 2018 17:38:21 +0000
4Subject: [PATCH] VirtualboxTouchScreenHandler initialize m_mouse
5
6* make sure m_mouse is initialized for cases where shutdown is called before:
7  m_mouse = EvdevMouseHandler::create(evdev_device, specification);
8  e.g. with following ioctl fails with vboxguest driver from vanila 4.19 kernel:
9  ioctl(m_fd, _IOWR('V', 10, features), &features);
10
11* fixes following crash:
12(gdb) set args -plugin evdevkeyboard -plugin vboxtouch
13(gdb) r
14Starting program: /usr/sbin/luna-next -plugin evdevkeyboard -plugin vboxtouch
15warning: File "/usr/lib/libstdc++.so.6.0.25-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
16To enable execution of this file add
17        add-auto-load-safe-path /usr/lib/libstdc++.so.6.0.25-gdb.py
18line to your configuration file "/media/internal/.gdbinit".
19To completely disable this security protection add
20        set auto-load safe-path /
21line to your configuration file "/media/internal/.gdbinit".
22For more information about this security protection see the
23"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
24        info "(gdb)Auto-loading safe path"
25[Thread debugging using libthread_db enabled]
26Using host libthread_db library "/lib/libthread_db.so.1".
27** Message: 17:05:20.472: App to allow in Low memory: org.webosports.app.phone
28** Message: 17:05:20.479: App to allow in Low memory: org.webosports.app.contacts
29** Message: 17:05:20.479: App to allow in Low memory: org.webosports.app.messaging
30
31** (process:993): WARNING **: 17:05:20.485: Settings::load(): 6 application paths defined:
32** Message: 17:05:20.487: Running on authenticamd with hardware type emulator
33pci id for fd 7: 80ee:beef, driver (null)
34BFD: error: /usr/lib/llvm6.0/.debug/libLLVM-6.0.so(.debug_info) is too large (0x2a793ad1 bytes)
35warning: Can't read data for section '.debug_info' in file '/usr/lib/llvm6.0/.debug/libLLVM-6.0.so'
36[New Thread 0xafe21b40 (LWP 997)]
37[New Thread 0xaf620b40 (LWP 998)]
38BFD: error: /usr/lib/.debug/libQt5Quick.so.5.11.3(.debug_info) is too large (0x5a05c4d bytes)
39warning: Can't read data for section '.debug_info' in file '/usr/lib/.debug/libQt5Quick.so.5.11.3'
40DEBUG: 17:05:39.393: vboxtouch: Using vbox device /dev/vboxguest
41WARNING: 17:05:39.402: vboxtouch setpointershape: ioctl error: Invalid argument
42WARNING: 17:05:39.403: vboxtouch init: ioctl error: Invalid argument
43DEBUG: 17:05:39.403: shutting down vboxtouch
44
45Thread 1 "luna-next" received signal SIGSEGV, Segmentation fault.
460xaee18e1c in VirtualboxTouchScreenHandler::shutdown (this=0x80da570) at /usr/src/debug/qt5-plugin-generic-vboxtouch/1.1.4+gitrAUTOINC+3f2bdb5a1d-r0/git/vboxtouch/vboxtouch.cpp:179
47179             delete m_mouse;
48(gdb) bt
49 #0  0xaee18e1c in VirtualboxTouchScreenHandler::shutdown (this=0x80da570) at /usr/src/debug/qt5-plugin-generic-vboxtouch/1.1.4+gitrAUTOINC+3f2bdb5a1d-r0/git/vboxtouch/vboxtouch.cpp:179
50 #1  0xaee19319 in VirtualboxTouchScreenHandler::VirtualboxTouchScreenHandler (this=0x80da570, specification=..., parent=0x0) at /usr/src/debug/qt5-plugin-generic-vboxtouch/1.1.4+gitrAUTOINC+3f2bdb5a1d-r0/git/vboxtouch/vboxtouch.cpp:122
51 #2  0xaee1877b in VirtualboxTouchScreenPlugin::create (this=0x80d7a30, key=..., specification=...) at /usr/src/debug/qt5-plugin-generic-vboxtouch/1.1.4+gitrAUTOINC+3f2bdb5a1d-r0/git/vboxtouch/main.cpp:51
52 #3  0xb7afc6c1 in qLoadPlugin<QObject, QGenericPlugin, QString const&> (key=..., loader=<optimized out>) at ../../include/QtCore/../../../git/src/corelib/kernel/qobject.h:499
53
54Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
55Upstream-Status: Pending
56---
57 vboxtouch/vboxtouch.cpp | 2 +-
58 1 file changed, 1 insertion(+), 1 deletion(-)
59
60diff --git a/vboxtouch/vboxtouch.cpp b/vboxtouch/vboxtouch.cpp
61index 6e0aac8..345fdcb 100644
62--- a/vboxtouch/vboxtouch.cpp
63+++ b/vboxtouch/vboxtouch.cpp
64@@ -82,7 +82,7 @@ const static vbox_mouse_status_request blank_mouse_status_request = {
65 #define VBOXMOUSE_IS_ABSOLUTE 2
66
67 VirtualboxTouchScreenHandler::VirtualboxTouchScreenHandler(const QString &specification, QObject *parent)
68-    : QObject(parent), m_fd(-1), m_notifier(0), m_device(0), m_failures(0),
69+    : QObject(parent), m_fd(-1), m_notifier(0), m_device(0), m_failures(0), m_mouse(0),
70       m_button(false), m_x(0), m_y(0)
71 {
72     setObjectName("Virtualbox Touch Handler");
73--
742.17.1
75
76