summaryrefslogtreecommitdiff
path: root/dev-lang/mono/files/mono-5.12-try-catch.patch
blob: 051c72be6859c2696a151a5dab4d6dc4e6c88d6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff -ur mono-5.9.0.398/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIX11.cs mono-patched-5.9.0.398/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIX11.cs
--- mono-5.9.0.398/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIX11.cs	2017-11-17 18:12:57.000000000 +0300
+++ mono-patched-5.9.0.398/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUIX11.cs	2017-12-06 06:24:45.067519852 +0300
@@ -2810,14 +2810,21 @@
 
 		internal override object ClipboardRetrieve(IntPtr handle, int type, XplatUI.ClipboardToObject converter)
 		{
-			XConvertSelection(DisplayHandle, handle, (IntPtr)type, (IntPtr)type, FosterParent, IntPtr.Zero);
+			try
+			{
+				XConvertSelection(DisplayHandle, handle, (IntPtr)type, (IntPtr)type, FosterParent, IntPtr.Zero);
 
-			Clipboard.Retrieving = true;
-			while (Clipboard.Retrieving) {
-				UpdateMessageQueue(null, false);
-			}
+				Clipboard.Retrieving = true;
+				while (Clipboard.Retrieving) {
+					UpdateMessageQueue(null, false);
+				}
 
-			return Clipboard.Item;
+				return Clipboard.Item;
+			}
+			catch (Exception ex)
+			{
+				return null;
+			}
 		}
 
 		internal override void ClipboardStore (IntPtr handle, object obj, int type, XplatUI.ObjectToClipboard converter, bool copy)