Browse Source

wxGUI: avoid flush clipboard if not opened (#819)

Fixes #786
nilason 4 năm trước cách đây
mục cha
commit
3dc4089ddc
2 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 2 1
      gui/wxpython/gui_core/goutput.py
  2. 2 1
      gui/wxpython/gui_core/prompt.py

+ 2 - 1
gui/wxpython/gui_core/goutput.py

@@ -692,7 +692,8 @@ class GStc(stc.StyledTextCtrl):
         """The clipboard contents can be preserved after
         the app has exited"""
 
-        wx.TheClipboard.Flush()
+        if wx.TheClipboard.IsOpened():
+            wx.TheClipboard.Flush()
         evt.Skip()
 
     def AddTextWrapped(self, txt, wrap=None):

+ 2 - 1
gui/wxpython/gui_core/prompt.py

@@ -619,7 +619,8 @@ class GPromptSTC(GPrompt, wx.stc.StyledTextCtrl):
     def OnDestroy(self, event):
         """The clipboard contents can be preserved after
         the app has exited"""
-        wx.TheClipboard.Flush()
+        if wx.TheClipboard.IsOpened():
+            wx.TheClipboard.Flush()
         event.Skip()
 
     def OnCmdErase(self, event):