Hi again,

I have some code to test if XQueryTree works, but it produces this error:
    
    
    SIGSEGV: Illegal storage access. (Attempt to read from nil?)
    Segmentation fault (core dumped)

The error is produced in the line with the XQueryTree-Call.

The code looks like this:
    
    
    import
      x11/xlib,
      x11/x
    
    var
      myDisplay: PDisplay
      myWindow: Window
      myWindowReturn: PWindow
      parentReturn: PWindow
      childrenReturn: PPWindow
      numChildrenReturn: Pcuint
    
    myDisplay = XOpenDisplay(nil)
    if myDisplay == nil:
      quit "Unable to open display"
    
    myWindow = XDefaultRootWindow(myDisplay)
    echo repr(myDisplay)
    echo repr(myWindow)
    let myStatus: Status = XQueryTree(myDisplay, myWindow, myWindowReturn, 
parentReturn, childrenReturn, numChildrenReturn)
    
    if myStatus != 0:
      echo "Query successful!"
      # Process the windows here
    else:
      echo "Query failed"
    
    discard XCloseDisplay(myDisplay)
    
    
    Run

Does anybody have any idea what I'm doing wrong?

Reply via email to