Menu

#1243 ::GetCursorPos fail (with Access Denied)

Bug
closed-fixed
Scintilla (812)
5
2015-01-19
2011-11-16
No

If I don't check the return code of ::GetCursorPos like this (in ScintillaWin.cxx):

    case WM\_SETCURSOR:
        if \(LoWord\(lParam\) == HTCLIENT\) \{
            if \(inDragDrop == ddDragging\) \{
                DisplayCursor\(Window::cursorUp\);
            \} else \{
                // Display regular \(drag\) cursor over selection
                POINT pt;
                if \(0 \!= ::GetCursorPos\(&pt\)\) \{
                    ::ScreenToClient\(MainHWND\(\), &pt\);
                    if \(PointInSelMargin\(Point\(pt.x, pt.y\)\)\) \{
                        DisplayCursor\(GetMarginCursor\(Point\(pt.x, pt.y\)\)\);
                    \} else if \(PointInSelection\(Point\(pt.x, pt.y\)\) && \!SelectionEmpty\(\)\) \{
                        DisplayCursor\(Window::cursorArrow\);
                    \} else if \(PointIsHotspot\(Point\(pt.x, pt.y\)\)\) \{
                        DisplayCursor\(Window::cursorHand\);
                    \} else \{
                        DisplayCursor\(Window::cursorText\);
                    \}
                \}
            \}
            return TRUE;
        \} else \{
            return ::DefWindowProc\(MainHWND\(\), iMessage, wParam, lParam\);
        \}

I get an Assertion failue (something with Virtual Space < 80000).

The GetCursorPos error was "Access Denied" (my code at frist checked which error).

The problem often occurs when the editor has been left alone for a long time (in which case my screen saver also switches on).

Discussion

  • Thomas Linder Puls

    That did not look well. The important part is:

    if (0 != ::GetCursorPos(&pt)) {
    ...
    }

     
  • Thomas Linder Puls

    wm_setcursor (rewritten)

     
  • Neil Hodgson

    Neil Hodgson - 2011-11-16
    • assigned_to: nobody --> nyamatongwe
    • status: open --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2011-11-16

    OK, committed.

     
  • Neil Hodgson

    Neil Hodgson - 2011-12-08
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.