andyvorld / LGSTrayBattery

A tray app used to track battery levels of wireless Logitech mouse.
GNU General Public License v3.0
369 stars 30 forks source link

tray disappears / app dies #64

Closed veepee78 closed 10 months ago

veepee78 commented 1 year ago

When I run the app, it run couple of days and then just disappears at some time. Computer is running 24/7. Tried to check eventviewer but didn't find any clues why this happens. I'm using this with K830.

settings: [HTTPServer] serverEnable = false tcpPort = 12321 tcpAddr = 127.0.0.1

[DeviceManager] GHUB = true HID_NET = false Native = true

fuflo commented 1 year ago

I have the same behaviour. Check the folder with the exe, there's probably crashlog_<timetsamp>.log files in there. It is for me, and the crashes are always at the same place:

System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
   at System.Drawing.Bitmap.GetHicon()
   at LGSTrayGUI.TrayIconTools.GenerateIcon(LogiDevice logiDevice) in E:\repos\LGSTrayBattery\LGSTrayGUI\TrayIconTools.cs:line 80
   at LGSTrayGUI.MainWindowViewModel.UpdateBatteryIcon(Object sender, PropertyChangedEventArgs e) in E:\repos\LGSTrayBattery\LGSTrayGUI\MainWindowViewModel.cs:line 99
   at LGSTrayCore.LogiDevice.set_LastUpdate(DateTime value) in E:\repos\LGSTrayBattery\LGSTrayCore\LogiDevice.cs:line 27
   at LGSTrayGHUB.NativeDeviceManager.battery_update_cb(String dev_id, Int32 bat_percent, Boolean charging, Double mileage, Int32 bat_mv) in E:\repos\LGSTrayBattery\LGSTrayNative\NativeDeviceManager.cs:line 73

My config is

[HTTPServer]
serverEnable = false
tcpPort = 12321
tcpAddr = 127.0.0.1

[DeviceManager]
GHUB = false
HID_NET = false
Native = true

Using only native hid.

Using G703 mouse and G915 TKL kb. Two separate folders for the two exes, both crash randomly with same exception.

veepee78 commented 1 year ago

I don't have any log files unfortunately.

Emah234 commented 1 year ago

This app was working fine with my PRO X SUPERLIGHT wireless mouse and G715 wireless keyboard, but I started having this same issue when I bought and connected my G735 headset. All my 3 exe's crashed at startup.

I ended up fixing it with having only GHUB as true in the Device Manager section (for all 3 exe's). They are currently working. I tested native and did not work. I did not test HID_NET, though.

andyvorld commented 10 months ago

As @finpluto mentioned, this is due to a memory leak in the old handling of tray icons. The v3 (still in pre-release) should have the fix, https://github.com/andyvorld/LGSTrayBattery/releases/tag/v3.0.0-rc.2