Good Day All,

I am using the following code to open and display html content.

Qt Code:
  1. void MyClass::playHtml(QString filePath, int w, int h) {
  2. QUrl url = QUrl::fromLocalFile(filePath);
  3.  
  4. mWidget = new QWebView(this);
  5. mWidget->page()->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
  6. mWidget->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
  7. mWidget->setGeometry(0, 0, width(), height());
  8.  
  9. float h_scale = (float) height() / h;
  10. float w_scale = (float) width() / w;
  11. float zoom = 1.0;
  12. if (h_scale < w_scale) {
  13. zoom = h_scale;
  14. } else {
  15. zoom = w_scale;
  16. }
  17. mWidget->setZoomFactor(zoom);
  18. mWidget->load(url);
  19.  
  20. mWidget->show();
  21. }
To copy to clipboard, switch view to plain text mode 
This is inside the MyClass, which sets its own geometry and this function scales the QWebView appropriately to maintain aspect ratio. The Deletion for the mWidget(QWebView pointer) is being called when the MyClass object is deleted. Here is the process of how it is called.
1.) MyClass is instantiated as “mclass”.
2.) after instantiation, the playHtml method above is called on mclass object
3.) the playHtml method above takes the full path to an html file that resides in a self-contained folder, the w/h are the pre-determined dimensions of the html content are used in scaling
4.) after about 25 seconds, the mclass object is deleted
4a.) during those 25 seconds the playHtml method scales the html content appropriately, and loads the html file. A lot of javascript happens for animation, etc.
5.) after the deletion another instantiation of MyClass occurs and the process is repeated

this process can be repeated literally 3000 times in a day, one after another. Neither the cpu nor ram are taxed during this time. The only thing I left out of the process above is the logging. I installed a MessageHandler to log the qDebug and other messages.

Here is what I am seeing in the logs after the above process runs for a while (anywhere from a couple of hours to a few days).

A bunch of these per instance of “MyClass”

Qt Code:
  1. CRITICAL: QWindowsBackingStore::flush: GetDC failed ()
To copy to clipboard, switch view to plain text mode 

followed by a bunch of these per instance of “MyClass”

Qt Code:
  1. CRITICAL: QWindowsBackingStore::flush: BitBlt failed ()
To copy to clipboard, switch view to plain text mode 
Followed shortly by a crash.

In the event viewer, I get the crash “Error” message. It is always in one of these faulting modules MSVCR100.dll or one of the Qt5Webkit or Qt5WebkitWidget dlls.

I am not specifically drawing anything. I relying on the QWebView to do that — both for drawing itself and the content it contains. It does it well except when the above starts occurring. Nothing else is running on the machine except the software.

How would one go about detecting errors like this? At this point, I don’t know anything about them until they get to the log. I would like to detect and deal with them before that time but am unsure how. As a side note, I would like to take this opportunity to learn more about error detection in general for Qt and C++. Primarily, how do I detect errors like this that seem to be occurring further up the food chain. I fear I have been spoiled by the stack traces provided by Java/C#.

Environment information:
Windows 7 professional 64bit
Qt 5.2.1 (32 bit)
Compiled using VS2010

Thanks!

-Jason