QWebPage and multithrading
===

I have this code:
    class TestThread : public QThread
    {
    public:
    	void run()
    	{
    		QFile file("test.html");
    		file.open(QIODevice::ReadOnly);
    		QWebPage page;
    		page.mainFrame()->setHtml(file.readAll());
    		qDebug() << page.mainFrame()->toHtml();
    		qDebug() << "\n\n\n\n";
    	}
    };
    
    int main(int argc, char *argv[])
    {
    	QApplication a(argc, argv);
    	for(int i = 0; i < 2; ++i)
    	{
    		TestThread thread;
    		thread.start();
    		thread.wait();
    	}
    	return a.exec();
    }

And output:

    "<html><head>
        <title>My page</title>
      </head>
      <body>
            My content
      
    </body></html>" 
    
    
    
    
     
    "<html><head></head><body><html>
      <head>
        <title>My page</title>
      </head>
      <body>
            My content
      </body>
    </html></body></html>"

In the second pass, there are too many tags. What is workaround? Or where is my mistake?