Problem when typing text and switching language

Description

I added text box on a picture, typed in several words. Then I am pressing Ctrl+1 (in my case this combination switches input language to english, Ctrl+2 = ukrainian, Ctrl+3 = russian) and I am getting this exception.

Software version: 1.2.6.7-RELEASE-359dcf30f24ef0257b3b319f729e0eb81106c37e (64 bit)
.NET runtime version: 4.0.30319.34209+
Time: 2015-08-06 14:08:03 +03:00
OS: unknown Enterprise (x64) 6.3 build 9600 revision 0
GDI object count: 197
User object count: 120
Surface count: 1
Exception: System.OverflowException
Message: Arithmetic operation resulted in an overflow.

Stack:
at System.Windows.Forms.InputLanguageChangingEventArgs..ctor(InputLanguage inputLanguage, Boolean sysCharSet)
at System.Windows.Forms.Control.WmInputLangChangeRequest(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBox.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Environment

Windows 8.1

Activity

Show:
Ihor Bobak
August 22, 2015, 2:56 AM

Robin,

I can't add messages to JIRA.

I am a programmer. Got an idea - maybe not very clever one, but I'd rather
tell it to you instead of not tell.

What if you make the code like this (in a pseudo-code):

do
{
h = CreateDialog();
if (h >= 0x7FFFFFFF)
DestroyDialog(h);
}
while(h >= 0x7FFFFFFF)
ShowDialog(h);

so that prior showing it, we will kill the dialog box in the case if handle
has higher bit set and will try to re-create it again.

Again: I don't know how stupid is this. But if creating a dialog is not a
complicated operation, that may work.

Regards,
Ihor

On Fri, Aug 21, 2015 at 5:37 PM, Robin Krom (JIRA) <

Robin Krom
September 24, 2015, 5:49 PM

After I understood the thing that was suggested at stackoverflow, I implemented & added the message filter in Greenshot 1.3.
Trying to create a dialog in a loop will cause so many bad effects that it is a bad idea...

I am currently trying to see how I can test this correctly, if this works I might bring out a bug-fix for 1.2 without much news... working on 1.3 with a speed which I don't want to pause.

Robin Krom
September 24, 2015, 7:37 PM

Found out that the error, other rather the messages that causes the error, doesn't show on Windows 7.

I found some additional information here:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms632630(v=vs.85).aspx
And here:
http://www.siao2.com/2006/05/16/598980.aspx

As Greenshot doesn't need the message, it's okay to filter them out... just need to be able to test the fix before I roll it out.
Will see if the error does again show on Windows 10 later, I currently don't have a Windows 8.1 at al.

Robin Krom
October 5, 2015, 8:21 AM

I created a new Greenshot version for this bug, you can download it here: https://github.com/greenshot/greenshot/releases

Robin Krom
January 21, 2021, 8:17 AM

Cleaning up our Jira...
This was solved for ages, sorry about that.

Fixed

Assignee

Robin Krom

Reporter

Ihor Bobak

Affects versions

None

Components

Priority

Major

Labels

None