Standard windows open/save dialog is broken by WebKit
Asked Answered
G

3

7

Our team is developing a complex application using Qt 4.7.4. One of the key functions we provide requires HTML+JS content rendered by QWebBrowser.

The problem is that loading of some pages leads to the broken open/save dialogs:

enter image description here

The dialog still "works" in terms of interaction: the file filter combobox can be opened, file name can be entered, but all of this is drawn wrong. File list and directory tree is not drawn at all.

I have found no bugreports about this problem on Qt bug tracker and google. We decided that the problem is local to our project. We suppose that some comctl32.dll internal structures is ruined by someone's write operation to invalid address, but we have no idea how to catch the real cause. Also it is worth to mention that this problem does NOT appear with Qt 5.4 and on any version of windows less that 8.0. Unfortunately, we should build the next release still on Qt 4.8 (the project is huge, upgrade process takes significant amount of time).

How such problem can be debugged? What memory operations and/or WinAPI calls should be hooked? Any ideas is highly appreciated.

The toolchain is MSVC 9.0 (VS 2008)

Glasscock answered 4/9, 2015 at 10:2 Comment(1)
If you wish Qt 4.7 to work on Windows 8 & up, you're on your own to maintain it (or buy a custom contract for it). You could unload and reload comctl32.dll if possible. But most importantly, this points either to a Qt memory bug, or (more likely) to a memory bug in your code. Use static analyzers to see if you missed anything obvious. There are multiple out there, but given the size of your project you should be using at least PVS-Studio and Coverity, apart apart from the one that comes with recent Visual Studio versions.Heresiarch
G
4

Well, after spending a lot of time for investigations, we have discovered that the real cause of broken windows is loading of Flash plugin DLL.

We have found the correlation between the messages about DLL load in Debug window and the moment of breaking the dialog. The dialog breaks exactly after loading the Flash plugin.

To ensure this proposition, we moved the Flash DLL (NPSWF64_*.DLL) to another directory to make WebKit not able to find the plugin, and after application restart dialogs became fixed.

Glasscock answered 10/9, 2015 at 14:33 Comment(0)
J
4

Qt 4.7 (4.8 too) is pretty old and dusty these days. It does not support Windows > 7 AFAIK. You should definitely switch to Qt 5.

Jaeger answered 4/9, 2015 at 11:24 Comment(2)
Thanks for the answer! You are absolutely right, and we are already done a lot of work to move our codebase to Qt 5 (it goes already 4 months long), but the work won't be finished until the next product release, so we still need Qt 4.Glasscock
Well then, have tried 4.8? As it's still kinda supported, it MIGHT support Windows 8. I can not test it right now, sadly.Jaeger
G
4

Well, after spending a lot of time for investigations, we have discovered that the real cause of broken windows is loading of Flash plugin DLL.

We have found the correlation between the messages about DLL load in Debug window and the moment of breaking the dialog. The dialog breaks exactly after loading the Flash plugin.

To ensure this proposition, we moved the Flash DLL (NPSWF64_*.DLL) to another directory to make WebKit not able to find the plugin, and after application restart dialogs became fixed.

Glasscock answered 10/9, 2015 at 14:33 Comment(0)
S
3

Have you tried your application on another machine ? Like this thing also happend to my while i was working on a win 8 machine . For a few days i didn't knew what to , and after all i have tried it on win 7 pc and it worked. I thought something was wrong with my machine but it looks it's not.

Sjoberg answered 7/9, 2015 at 16:46 Comment(2)
Thank you for the answer! At this moment the problem is reproduced on every Win 8.1 machine our developers and QA's have. We have even tested it on Win 8.0 (without the update) with the same effect. The problem is never reproduced on Win 7 or Win XP, unfortunately I can not say anything about Win 10 now.Glasscock
BTW, what is your development toolchain? Are you using Qt too, or this problem appeared with another toolset?Glasscock

© 2022 - 2024 — McMap. All rights reserved.