Browse Source

[X11] Check for XOpenDisplay error _before_ trying to use display

pull/6724/head
Nikita Tsukanov 5 years ago
committed by GitHub
parent
commit
74c72f7aee
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/Avalonia.X11/X11Platform.cs

7
src/Avalonia.X11/X11Platform.cs

@ -52,11 +52,14 @@ namespace Avalonia.X11
XInitThreads();
Display = XOpenDisplay(IntPtr.Zero);
if (Display == IntPtr.Zero)
throw new Exception("XOpenDisplay failed");
DeferredDisplay = XOpenDisplay(IntPtr.Zero);
if (DeferredDisplay == IntPtr.Zero)
throw new Exception("XOpenDisplay failed");
OrphanedWindow = XCreateSimpleWindow(Display, XDefaultRootWindow(Display), 0, 0, 1, 1, 0, IntPtr.Zero,
IntPtr.Zero);
if (Display == IntPtr.Zero)
throw new Exception("XOpenDisplay failed");
XError.Init();
Info = new X11Info(Display, DeferredDisplay, useXim);

Loading…
Cancel
Save