Bug 29591
| Summary: | [Qt] QWebView takes ownership of QWebPage despite the documentation | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Tor Arne Vestbø <vestbo> |
| Component: | WebKit Qt | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED WORKSFORME | ||
| Severity: | Normal | CC: | hausmann, kent.hansen, tonikitoo |
| Priority: | P2 | Keywords: | Qt |
| Version: | 528+ (Nightly build) | ||
| Hardware: | Other | ||
| OS: | OS X 10.5 | ||
Tor Arne Vestbø
This bug report originated from Nokia internal issue QT-1959
--- Comments ---
Function: webkit
Version: 4.5.1
Platform: Linux
Linux NachBox 2.6.29-1-amd64 #1 SMP Fri Apr 17 10:12:36 UTC 2009 x86_64 GNU/Linux
Debian Unstable, up to date
Short description: QWebView takes ownership of QWebPage despite the documentation
Did:
Inside a class inherited from QMainWindow I created a QWebView, and assigned a page like so:
webView->setPage(new QWebPage(this));
Expected to see:
I expected everything to work normally. And exit cleanly.
Got instead:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f3fd0dca750 (LWP 10415)]
0x00007f3fd01f8c0b in QWebView::~QWebView () from ./libQtWebKit.so.4
Current language: auto; currently asm
(gdb) bt
More details:
Th documentation has this to say about QWebView:
void QWebView::setPage ( QWebPage * page )
Makes page the new web page of the web view.
The parent QObject of the provided page remains the owner of the object. If the current document is a child of the web view, it will be deleted.
------------------------------
I think that is incorrect, because it seems that the object was already deleted by my QMainWindow and then attempt to be deleted again by QWebView, and QWebView according to the above does not take ownership of the QWebPage, so it shouldn't try to delete it.
When I changed my code to webView->setPage(new QWebPage); everything worked smoothly, and I did not receive a segmentation fault on exit.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Simon Hausmann
Hmm, this shouldn't really happen as QWebView connects to the page's destroyed signal. We should close this issue if we have a unit-test for this.
Kent Hansen
Not able to reproduce, closing bug.