--- qsampler/trunk/src/qsampler.cpp 2016/09/26 09:37:11 2998 +++ qsampler/trunk/src/qsampler.cpp 2017/01/02 12:11:50 3065 @@ -1,8 +1,8 @@ // qsampler.cpp // /**************************************************************************** - Copyright (C) 2004-2016, rncbc aka Rui Nuno Capela. All rights reserved. - Copyright (C) 2007, 2008 Christian Schoenebeck + Copyright (C) 2004-2017, rncbc aka Rui Nuno Capela. All rights reserved. + Copyright (C) 2007,2008,2015 Christian Schoenebeck This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -203,10 +203,12 @@ m_pWidget = pWidget; #ifdef CONFIG_X11 #ifdef CONFIG_XUNIQUE - XGrabServer(m_pDisplay); m_wOwner = m_pWidget->winId(); - XSetSelectionOwner(m_pDisplay, m_aUnique, m_wOwner, CurrentTime); - XUngrabServer(m_pDisplay); + if (m_pDisplay && m_wOwner) { + XGrabServer(m_pDisplay); + XSetSelectionOwner(m_pDisplay, m_aUnique, m_wOwner, CurrentTime); + XUngrabServer(m_pDisplay); + } #endif // CONFIG_XUNIQUE #endif // CONFIG_X11 } @@ -219,7 +221,7 @@ { #ifdef CONFIG_X11 #ifdef CONFIG_XUNIQUE - if (m_wOwner != None) { + if (m_pDisplay && m_wOwner != None) { // First, notify any freedesktop.org WM // that we're about to show the main widget... Screen *pScreen = XDefaultScreenOfDisplay(m_pDisplay); @@ -264,7 +266,7 @@ #ifdef CONFIG_XUNIQUE void x11PropertyNotify(Window w) { - if (m_pWidget && m_wOwner == w) { + if (m_pDisplay && m_pWidget && m_wOwner == w) { // Always check whether our property-flag is still around... Atom aType; int iFormat = 0; @@ -505,3 +507,4 @@ // end of qsampler.cpp +