Merge pull request #6268 from erikd/topic/fixes

Minor fixes reported by AddressSanitizer
This commit is contained in:
Andrew Nelless 2018-03-14 13:36:29 +00:00 committed by GitHub
commit cd403562cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 16 additions and 11 deletions

4
.gitignore vendored
View File

@ -2,6 +2,7 @@ config.h
.DS_Store .DS_Store
*.pyc *.pyc
*.o *.o
*.a
*~ *~
\.*.swp \.*.swp
*build-gui-Desktop_Qt* *build-gui-Desktop_Qt*
@ -20,3 +21,6 @@ src/gui/.rnd
src/setup/win32/synergy.suo src/setup/win32/synergy.suo
CMakeCache.txt CMakeCache.txt
CMakeLists.txt.user CMakeLists.txt.user
Makefile
cmake_install.cmake
CMakeFiles/

View File

@ -150,6 +150,7 @@ ArchMultithreadPosix::~ArchMultithreadPosix()
closeMutex(m_threadMutex); closeMutex(m_threadMutex);
s_instance = nullptr; s_instance = nullptr;
delete m_mainThread;
} }
void void

View File

@ -175,7 +175,7 @@ App::initApp(int argc, const char** argv)
// this is a simple way to allow the core process to talk to X. this avoids // this is a simple way to allow the core process to talk to X. this avoids
// the "WARNING: primary screen unavailable: unable to open screen" error. // the "WARNING: primary screen unavailable: unable to open screen" error.
// a better way would be to use xauth cookie and dbus to get access to X. // a better way would be to use xauth cookie and dbus to get access to X.
if (static_cast<int>((!(argsBase().m_runAsUid) == 0 != -1))) { if (argsBase().m_runAsUid >= 0) {
if (setuid(argsBase().m_runAsUid) == 0) { if (setuid(argsBase().m_runAsUid) == 0) {
LOG((CLOG_DEBUG "process uid was set to: %d", argsBase().m_runAsUid)); LOG((CLOG_DEBUG "process uid was set to: %d", argsBase().m_runAsUid));
} }

View File

@ -27,10 +27,6 @@ m_stopOnDeskSwitch(false),
#else #else
m_daemon(true), // backward compatibility for unix (daemon by default) m_daemon(true), // backward compatibility for unix (daemon by default)
#endif #endif
#if WINAPI_XWINDOWS
m_disableXInitThreads(false),
m_runAsUid(-1),
#endif
m_backend(false), m_backend(false),
m_restartable(true), m_restartable(true),
m_noHooks(false), m_noHooks(false),
@ -39,6 +35,10 @@ m_logFilter(nullptr),
m_logFile(nullptr), m_logFile(nullptr),
m_display(nullptr), m_display(nullptr),
m_enableDragDrop(false), m_enableDragDrop(false),
#if WINAPI_XWINDOWS
m_disableXInitThreads(false),
m_runAsUid(-1),
#endif
m_shouldExit(false), m_shouldExit(false),
m_profileDirectory(""), m_profileDirectory(""),
m_pluginDirectory("") m_pluginDirectory("")

View File

@ -54,10 +54,10 @@ class EventQueueTimer { };
XWindowsEventQueueBuffer::XWindowsEventQueueBuffer( XWindowsEventQueueBuffer::XWindowsEventQueueBuffer(
Display* display, Window window, IEventQueue* events) : Display* display, Window window, IEventQueue* events) :
m_events(events),
m_display(display), m_display(display),
m_window(window), m_window(window),
m_waiting(false) m_waiting(false),
m_events(events)
{ {
assert(m_display != NULL); assert(m_display != NULL);
assert(m_window != None); assert(m_window != None);

View File

@ -97,6 +97,7 @@ XWindowsScreen::XWindowsScreen(
bool disableXInitThreads, bool disableXInitThreads,
int mouseScrollDelta, int mouseScrollDelta,
IEventQueue* events) : IEventQueue* events) :
PlatformScreen(events),
m_isPrimary(isPrimary), m_isPrimary(isPrimary),
m_mouseScrollDelta(mouseScrollDelta), m_mouseScrollDelta(mouseScrollDelta),
m_display(nullptr), m_display(nullptr),
@ -121,8 +122,7 @@ XWindowsScreen::XWindowsScreen(
m_xkb(false), m_xkb(false),
m_xi2detected(false), m_xi2detected(false),
m_xrandr(false), m_xrandr(false),
m_events(events), m_events(events)
PlatformScreen(events)
{ {
assert(s_screen == NULL); assert(s_screen == NULL);
@ -1415,8 +1415,8 @@ XWindowsScreen::handleSystemEvent(const Event& event, void* /*unused*/)
#if HAVE_X11_EXTENSIONS_XRANDR_H #if HAVE_X11_EXTENSIONS_XRANDR_H
if (m_xrandr) { if (m_xrandr) {
if (xevent->type == m_xrandrEventBase + RRScreenChangeNotify if ((xevent->type == m_xrandrEventBase + RRScreenChangeNotify
|| xevent->type == m_xrandrEventBase + RRNotify || xevent->type == m_xrandrEventBase + RRNotify)
&& reinterpret_cast<XRRNotifyEvent *>(xevent)->subtype == RRNotify_CrtcChange) { && reinterpret_cast<XRRNotifyEvent *>(xevent)->subtype == RRNotify_CrtcChange) {
LOG((CLOG_INFO "XRRScreenChangeNotifyEvent or RRNotify_CrtcChange received")); LOG((CLOG_INFO "XRRScreenChangeNotifyEvent or RRNotify_CrtcChange received"));