From 342a50648026f4a55c226bee840a9e2f0d2128cc Mon Sep 17 00:00:00 2001 From: "Krom, Robertus" Date: Fri, 23 Oct 2015 11:14:26 +0200 Subject: [PATCH] BUG-1809: Found some additional information which explains why the previous fix for BUG-1809 was not working. --- Greenshot/Forms/MainForm.cs | 27 ++++++++++++++++--- .../additional_files/readme.txt.template | 1 + .../Core/WmInputLangChangeRequestFilter.cs | 23 +++++++++++++--- appveyor.yml | 4 +-- 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/Greenshot/Forms/MainForm.cs b/Greenshot/Forms/MainForm.cs index 2561b9691..e58af6640 100644 --- a/Greenshot/Forms/MainForm.cs +++ b/Greenshot/Forms/MainForm.cs @@ -510,14 +510,20 @@ namespace Greenshot { get {return contextMenu;} } - #region hotkeys protected override void WndProc(ref Message m) { if (HotkeyControl.HandleMessages(ref m)) { return; } - base.WndProc(ref m); + // BUG-1809 prevention, filter the InputLangChange messages + if (WmInputLangChangeRequestFilter.PreFilterMessageExternal(ref m)) + { + return; + } + base.WndProc(ref m); } + #region hotkeys + /// /// Helper method to cleanly register a hotkey /// @@ -1225,14 +1231,27 @@ namespace Greenshot { private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Exception exceptionToLog = e.ExceptionObject as Exception; string exceptionText = EnvironmentInfo.BuildReport(exceptionToLog); - LOG.Error(EnvironmentInfo.ExceptionToString(exceptionToLog)); + LOG.Error("Exception caught in the UnhandledException handler."); + LOG.Error(exceptionText); + if (exceptionText != null && exceptionText.Contains("InputLanguageChangedEventArgs")) + { + // Ignore for BUG-1809 + return; + } new BugReportForm(exceptionText).ShowDialog(); } private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { Exception exceptionToLog = e.Exception; string exceptionText = EnvironmentInfo.BuildReport(exceptionToLog); - LOG.Error(EnvironmentInfo.ExceptionToString(exceptionToLog)); + LOG.Error("Exception caught in the ThreadException handler."); + LOG.Error(exceptionText); + if (exceptionText != null && exceptionText.Contains("InputLanguageChangedEventArgs")) + { + // Ignore for BUG-1809 + return; + } + new BugReportForm(exceptionText).ShowDialog(); } diff --git a/Greenshot/releases/additional_files/readme.txt.template b/Greenshot/releases/additional_files/readme.txt.template index b09e57a9c..6ec082c85 100644 --- a/Greenshot/releases/additional_files/readme.txt.template +++ b/Greenshot/releases/additional_files/readme.txt.template @@ -13,6 +13,7 @@ Bugs Resolved: * BUG-1809: OverflowException when changing the windows input language * BUG-1835: Imgur: uploads were cancelled due to a timeout which was set too small * BUG-1833: Imgur: API-Key issues when using anonymous uploads +* Github Pull 1: Fixed error calling external command. Thanks to viper3400 1.2.6.7-359dcf3 RELEASE diff --git a/GreenshotPlugin/Core/WmInputLangChangeRequestFilter.cs b/GreenshotPlugin/Core/WmInputLangChangeRequestFilter.cs index 5e2ad2699..f1caf717c 100644 --- a/GreenshotPlugin/Core/WmInputLangChangeRequestFilter.cs +++ b/GreenshotPlugin/Core/WmInputLangChangeRequestFilter.cs @@ -28,21 +28,38 @@ namespace GreenshotPlugin.Core /// /// This IMessageFilter filters out all WM_INPUTLANGCHANGEREQUEST messages which go to a handle which is >32 bits. /// The need for this is documented here: http://stackoverflow.com/a/32021586 - /// Unfortunately there is an error in the code example, should use HWnd instead of LParam for the handle. /// public class WmInputLangChangeRequestFilter : IMessageFilter { private static readonly ILog LOG = LogManager.GetLogger(typeof(WmInputLangChangeRequestFilter)); + /// + /// This will do some filtering + /// + /// Message + /// true if the message should be filtered public bool PreFilterMessage(ref Message m) + { + return PreFilterMessageExternal(ref m); + } + + /// + /// Also used in the MainForm WndProc + /// + /// Message + /// true if the message should be filtered + public static bool PreFilterMessageExternal(ref Message m) { WindowsMessages message = (WindowsMessages)m.Msg; if (message == WindowsMessages.WM_INPUTLANGCHANGEREQUEST || message == WindowsMessages.WM_INPUTLANGCHANGE) { LOG.WarnFormat("Filtering: {0}, {1:X} - {2:X} - {3:X}", message, m.LParam.ToInt64(), m.WParam.ToInt64(), m.HWnd.ToInt64()); - return (m.LParam.ToInt64() | 0xFFFFFFFF) != 0; + // For now we always return true + return true; + // But it could look something like this: + //return (m.LParam.ToInt64() | 0x7FFFFFFF) != 0; } return false; } - } + } } \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index f7efdd5d2..2b4283e3e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.2.6.{build} +version: 1.2.7.{build} branches: only: - 1.2 @@ -37,7 +37,7 @@ environment: secure: bjKXhFZkDqaq98XBrz5oQKQfT8CLpuv2ZAiBIwkzloaAPUs97b5yx6h/xFaE4NLS credentials_picasa_consumer_secret: secure: yNptTpmJWypbu9alOQtetxU66drr2FKxoPflNgRJdag= - build_type: UNSTABLE + build_type: RELEASE rsakey: secure: GNomwdlwZOCyd8d7xEWTnMVs1lpOeHvF+tlnvcbXGovLRtwAp2Ufu0r7paGY7BHGGkIs2WE7xUfyQ9UauVB+58JZ6fwVega8ucUgVJhl4x0QQNN2d6sULUhHfhuEHmxw+FDO/FxKFE6Lmf+ZRY+OGiw0wKIl4qD7mGRHcDQTipNEsTbau8HzqRVCdu3dx7pODC61DlsbO71xLF7UlqnmuZE+91Zz3V6AgaqE246n1499d6bXBYw1AH+8opNnKDFLnTHf7hUVcZn9mj6tKZXeTCuVUOr/SVQcgHKxlBlqzhfaEkxCR5GPtzQRqwDMxEycmFvj2wNP/sie6UEGhQxE4YMCc2OgqNOkpc5BbP/fxLr/SLFOEf1XXzTWCFMhsgpHx7TZbgQH26sa0rK/xaBRacZlwAaNk7V2nFZT7TebYEFy6zWNr9Y+IyeXIofj42XQTNXv8d8hyh+UYLByVEFYRf2DnActQkZQyNdWjZ+CxDV50QSZZs8FT3IIqraHYKsj2ITAN5LrUtWCi7bpNJL0UGo0EJiB2i0bp++tEAAwyrCljxI8d4bbGl/flHk/xd+ysQPnomndijeObjguEzqT8pyXZluSZhF+lI50mIDhMdtdAfMi5yn5RW7P6NWOSlC8xgQQgMZylsuSvRflKbEd/gsoDyEOnakNcdH2jekt9OD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