diff --git a/uppsrc/CtrlCore/X11Wnd.cpp b/uppsrc/CtrlCore/X11Wnd.cpp index 4882394d3..a949638d5 100644 --- a/uppsrc/CtrlCore/X11Wnd.cpp +++ b/uppsrc/CtrlCore/X11Wnd.cpp @@ -861,7 +861,7 @@ void Ctrl::KillFocus(Window window) if(q < 0) return; XWindow& w = Xwindow()[q]; - if(w.ctrl) + if(w.ctrl) w.ctrl->KillFocusWnd(); } @@ -873,10 +873,13 @@ void Ctrl::SetWndFocus0(bool *b) if(top && top->window != focusWindow && IsEnabled() && IsVisible()) { LLOG("Setting focus... "); LTIMING("XSetInfputFocus"); + Ptr _this = this; KillFocus(focusWindow); - XSetInputFocus(Xdisplay, top->window, RevertToParent, CurrentTime); - focusWindow = top->window; - SetFocusWnd(); + if(_this && top) { + XSetInputFocus(Xdisplay, top->window, RevertToParent, CurrentTime); + focusWindow = top->window; + SetFocusWnd(); + } *b = true; } } @@ -1003,8 +1006,10 @@ void Ctrl::SetWndForeground0() w->last_active->SetWndForeground(); } else { + Ptr _this = this; SetWndFocus(); - XRaiseWindow(Xdisplay, top->window); + if(_this && top) + XRaiseWindow(Xdisplay, top->window); } } diff --git a/uppsrc/ide/Assist.cpp b/uppsrc/ide/Assist.cpp index 3692672e5..0589e9c4c 100644 --- a/uppsrc/ide/Assist.cpp +++ b/uppsrc/ide/Assist.cpp @@ -23,6 +23,7 @@ AssistEditor::AssistEditor() assist.NoHeader(); assist.NoGrid(); assist.AddColumn().Margin(0).SetDisplay(Single()); + assist.NoWantFocus(); assist.WhenLeftClick = THISBACK(AssistInsert); type.NoHeader(); type.NoGrid();