Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenClipboard fail crashing the OptiKey #862

Open
alexandre-mbm opened this issue Sep 8, 2022 · 0 comments
Open

OpenClipboard fail crashing the OptiKey #862

alexandre-mbm opened this issue Sep 8, 2022 · 0 comments

Comments

@alexandre-mbm
Copy link
Contributor

alexandre-mbm commented Sep 8, 2022

This fail happened while there was a VNC section. I think handling the exception be solution (and an error notification).

2022-09-07 22:34:59,469 [ 1] INFO  JuliusSweetland.OptiKey.UI.ViewModels.MainViewModel: Copying text from scratchpad to clipboard.
2022-09-07 22:35:00,406 [ 1] ERROR JuliusSweetland.OptiKey.OptiKeyApp: A DispatcherUnhandledException has been encountered...
System.Runtime.InteropServices.COMException (0x800401D0): Falha de OpenClipboard (Exceção de HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))
   em System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   em System.Windows.Clipboard.Flush()
   em System.Windows.Clipboard.CriticalSetDataObject(Object data, Boolean copy)
   em System.Windows.Clipboard.SetDataInternal(String format, Object data)
   em System.Windows.Clipboard.SetText(String text, TextDataFormat format)
   em System.Windows.Clipboard.SetText(String text)
   em JuliusSweetland.OptiKey.UI.ViewModels.MainViewModel.<HandleFunctionKeySelectionResult>d__66.MoveNext() na C:\dev\GitHub\OptiKey\src\JuliusSweetland.OptiKey.Core\UI\ViewModels\MainViewModel.ServiceEventHandlers.cs:linha 961
--- Fim do rastreamento de pilha do local anterior onde a exceção foi gerada ---
   em System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_0(Object state)
   em System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   em System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

The code around 961 line:

case FunctionKeys.CopyAllFromScratchpad:
    {
        Log.Info("Copying text from scratchpad to clipboard.");
        string textFromScratchpad = KeyboardOutputService.Text;

        if (!string.IsNullOrEmpty(textFromScratchpad))
        {
            Clipboard.SetText(textFromScratchpad);
        }
    }
    break;
@alexandre-mbm alexandre-mbm changed the title OpenClipboard fail OpenClipboard fail crashing the OptiKey Sep 8, 2022
@kmcnaught kmcnaught added this to Stability in Core OptiKey development Oct 21, 2022
@kmcnaught kmcnaught moved this from Stability to Done/for review in Core OptiKey development Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant