spillerrec / imgviewer

Customizable image viewer with minimalistic interface
2 stars 1 forks source link

Graphic resource leak on Windows #53

Closed spillerrec closed 8 years ago

spillerrec commented 8 years ago

Keeping an animated image playing for a long time seems to use up some limited graphic resource on Windows 10.

At first UI elements like buttons and similar will start flickering and break in strange ways, that is with all applications currently running on the system. After exiting imgviewer, applications generally seems to recover. If you ignore all warning signs and continue to let it run, the window manager starts becoming funky. Windows start to constantly change size and not respond to input. In my first test, the windows session died, letting me log on again with what looked like a safe graphics mode. In the second test, it completely messed up, with the task bar being on the top of the screen, all windows pushed into a ˝32x32 area, not responding to any input at all (I had to cut the power).

Steps to reproduce:

Causes Unknown, but believed to be something graphic related, and likely some limited windows resource which is being used up. However the code should not be able to leak, nor is there any code which directly uses Windows APIs to mess up like that used for displaying/animating. So it is likely a bug in relation to Qt or LittleCMS. The API usage of Qt should be correct, so that leaves only LittleCMS or an internal bug in Qt (which wouldn't be anything new).

Suggested approaches:

spillerrec commented 8 years ago

Memory leak have been found on Linux in imageContainer::update_toogle_btn():

QIcon icon( viewer->is_animating() ? ":/main/pause.png" : ":/main/start.png" );
ui->btn_pause->setIcon( icon );

It also updates the Windows toolbar button icon, but considering the confirmed leak it is likely in the above code. It needs to be confirmed if this is what causing the issue on Windows, but it appears to be a very promising candidate. There should not be any leakage due to this code, so it definitely is a Qt bug. It should be changed though, as it is stupid to load and decode the same image several times a second, which might circumvent the issue.

spillerrec commented 8 years ago

After the fix I can't recreate the issue any longer. I should try to make a minimal working example sometime and report the bug though.