فهرست منبع

Fixed gnome x11 clipboard copy

flabbet 3 هفته پیش
والد
کامیت
fc9637a9e8

+ 13 - 5
src/PixiEditor/Helpers/Extensions/DataObjectExtensions.cs

@@ -37,14 +37,22 @@ public static class DataObjectExtensions
             return false;
         }
 
-        string text = data.GetText();
-
-        if (Directory.Exists(text) || File.Exists(text))
+        try
+        {
+            var text = data.GetText();
+            if (Directory.Exists(text) || File.Exists(text))
+            {
+                path = text;
+                return true;
+            }
+        }
+        catch(InvalidCastException ex) // bug on x11
         {
-            path = text;
-            return true;
+            path = null;
+            return false;
         }
 
+
         path = null;
         return false;
     }

+ 9 - 1
src/PixiEditor/Models/Controllers/ClipboardController.cs

@@ -490,7 +490,15 @@ internal static class ClipboardController
             return null;
         }
 
-        string text = await importObj.GetDataAsync(DataFormats.Text) as string;
+        string text = null;
+        try
+        {
+            text = await importObj.GetDataAsync(DataFormats.Text) as string;
+        }
+        catch(InvalidCastException ex) // bug on x11
+        {
+        }
+
         string[] paths = [text];
         if (text == null)
         {