d2phap / ImageGlass

🏞 A lightweight, versatile image viewer
https://imageglass.org
Other
7.77k stars 501 forks source link

Crop button triggers Null Reference Exception #1758

Open alessandro-antonelli opened 11 months ago

alessandro-antonelli commented 11 months ago

System information:

Version: ImageGlass v9.0.8.1208 Release code: kobe OS: Microsoft Windows NT 10.0.19045.0 64-bit

To Reproduce

Steps to reproduce the behavior:

  1. Open an image with ImageGlass
  2. Press "c" or click on the crop button in the toolbar

Expected behavior:

The crop commands are displayed.

Actual behavior:

The following error message is shown:

Error:

Object reference not set to an instance of an object.
----------------------------------------------------

System.NullReferenceException: Object reference not set to an instance of an object.
   at ImageGlass.FrmCrop.OnUpdateHeight(Boolean performUpdate) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 142
   at ImageGlass.FrmCrop.OnDpiChanged(DpiChangedEventArgs e) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 93
   at System.Windows.Forms.Form.WmDpiChanged(Message& m)
   at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:\_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 200
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

If you click on the button "Continue" each time, the error is displayed again a second time, a third time, a fourth time, a fifth time. Then one last click on "continue" finally causes the crop commands to be displayed as desired.

Screenshots:

image

Additional context:

Already tried to use "Repair install" in control panel, but it did not solve the issue.

d2phap commented 10 months ago

Hi @alessandro-antonelli Can you please send a video? I cannot reproduce this issue.

sdsy888 commented 9 months ago

Hi @alessandro-antonelli Can you please send a video? I cannot reproduce this issue.

Hi @d2phap , please check the video below

https://github.com/d2phap/ImageGlass/assets/7611912/724f906e-44b4-4db4-8e1b-1420c6653365

d2phap commented 9 months ago

Can you check if it's fixed in ImageGlass 9.0.10.201

alessandro-antonelli commented 9 months ago

Still not fixed, but the stack trace in the error message has changed.

Error message before updating:

Version: ImageGlass v9.0.9.1230 Release code: kobe OS: Microsoft Windows NT 10.0.19045.0 64-bit


Error:

Object reference not set to an instance of an object.

System.NullReferenceException: Object reference not set to an instance of an object. at ImageGlass.FrmCrop.OnUpdateHeight(Boolean performUpdate) in D:_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 142 at ImageGlass.FrmCrop.OnDpiChanged(DpiChangedEventArgs e) in D:_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 93 at System.Windows.Forms.Form.WmDpiChanged(Message& m) at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 200 at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

Error message after updating:

Version: ImageGlass v9.0.10.201 Release code: kobe Magick.NET: Magick.NET Q16-HDRI-OpenMP x64 netstandard21 13.5.0 WebView2 Runtime: 120.0.2210.144 OS: Microsoft Windows NT 10.0.19045.0 64-bit


Error:

Object reference not set to an instance of an object.

System.NullReferenceException: Object reference not set to an instance of an object. at ImageGlass.FrmCrop.ApplyTheme(Boolean darkMode, Nullable`1 style) in D:_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 65 at ImageGlass.FrmCrop.OnDpiChanged(DpiChangedEventArgs e) in D:_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 95 at System.Windows.Forms.Form.WmDpiChanged(Message& m) at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 200 at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

d2phap commented 9 months ago

Thanks @alessandro-antonelli for the info, I will try to check again.

MadDogDean commented 3 months ago

I can confirm that this is still happening with the 9.17.7.627 build.

Also, with the aforementioned error dialog, if the Continue is clicked 4 times, the crop tool finally appears, but the dialog box is malformed.

HTH, MadDogDean

image

image

image

d2phap commented 3 months ago

Can help me check if this happens to Color Picker tool as well?

MadDogDean commented 3 months ago

Yes it also happens with Color Picker.

Again, I can click Continue 4 times and then a malformed Color Picker dialog box appears.

I did notice that the error messages are slightly different in each instance.

This is the error message on the Crop tool:

Version: ImageGlass v9.1.7.627
Release code: kobe
Magick.NET: Magick.NET Q16-HDRI-OpenMP x64 netstandard21 13.9.1
WebView2 Runtime: 126.0.2592.102
OS: Microsoft Windows NT 10.0.22631.0 64-bit

----------------------------------------------------
Error:

Object reference not set to an instance of an object.
----------------------------------------------------

System.NullReferenceException: Object reference not set to an instance of an object.
   at ImageGlass.FrmCrop.ApplyTheme(Boolean darkMode, Nullable`1 style) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 65
   at ImageGlass.FrmCrop.OnDpiChanged(DpiChangedEventArgs e) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmCrop.cs:line 95
   at System.Windows.Forms.Form.WmDpiChanged(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:\_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 221
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

This is the error message on the Color Picker tool:

Version: ImageGlass v9.1.7.627
Release code: kobe
Magick.NET: Magick.NET Q16-HDRI-OpenMP x64 netstandard21 13.9.1
WebView2 Runtime: 126.0.2592.102
OS: Microsoft Windows NT 10.0.22631.0 64-bit

----------------------------------------------------
Error:

Object reference not set to an instance of an object.
----------------------------------------------------

System.NullReferenceException: Object reference not set to an instance of an object.
   at ImageGlass.FrmColorPicker.OnUpdateHeight(Boolean performUpdate) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmColorPicker.cs:line 152
   at ImageGlass.FrmColorPicker.OnDpiChanged(DpiChangedEventArgs e) in D:\_GITHUB\@d2phap\ImageGlass\Source\ImageGlass\Tools\FrmColorPicker.cs:line 90
   at System.Windows.Forms.Form.WmDpiChanged(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at ImageGlass.UI.ModernForm.WndProc(Message& m) in D:\_GITHUB\@d2phap\ImageGlass\Source\Components\ImageGlass.UI\Forms\ModernForm.cs:line 221
   at System.Windows.Forms.NativeWindow.Callback(HWND hWnd, MessageId msg, WPARAM wparam, LPARAM lparam)

image

MadDogDean commented 3 months ago

BTW, This is my Windows version

image :

MadDogDean commented 3 months ago

Today I noticed that the error generated by the Crop & Color Picker tools happens with images opened into ImageGlass. If an image is copied to the clipboard (right-click on image and Copy in File Explorer or copied from any other resource, browser, etc) and then pasted into IG, the Crop or Color Picker error is not generated. The Dialog boxes are not malformed and all function as expected