Bug 129869 - [GTK] Runtime error when page is closed while print operation is in progress
Summary: [GTK] Runtime error when page is closed while print operation is in progress
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2014-03-07 01:49 PST by Carlos Garcia Campos
Modified: 2014-03-12 11:27 PDT (History)
1 user (show)

See Also:


Attachments
Patch (6.61 KB, patch)
2014-03-07 01:57 PST, Carlos Garcia Campos
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2014-03-07 01:49:11 PST
It doesn't always happen, but it can be easily reproduced running test /webkit2/WebKitPrintOperation/close-after-print

$ Programs/TestWebKitAPI/WebKit2Gtk/TestPrinting -p /webkit2/WebKitPrintOperation/close-after-print
/webkit2/WebKitPrintOperation/close-after-print: OK
pure virtual method called
terminate called without an active exception

This happens because the page is closed when the pages have been printed, but print job is still ongoing sending the data to the printer. When print job finishes, we try to notify the UI process sending the print callback message using WebPage::send(), but the web page object has been destroyed. The virtual method it complains about is probably MessageSender::messageSenderDestinationID() used by send(). Since our print operation is always asynchronous, we need a way to notify the web page when the print operation has actually finished to clean it up, but also notify the print operation when the page has been closed to not try to notify the UI process in that case.
Comment 1 Carlos Garcia Campos 2014-03-07 01:57:33 PST
Created attachment 226099 [details]
Patch
Comment 2 Martin Robinson 2014-03-07 09:39:16 PST
Comment on attachment 226099 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=226099&action=review

GTK+ bits look good to me. I'll leave the rest to the WebKit2 owners.

> Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:418
> +void WebPrintOperationGtk::disconnectFromPage()

Maybe call this didDisconnectFromPage or notifyDisconnectFromPage since the disconnection actually happens earlier?
Comment 3 Carlos Garcia Campos 2014-03-07 09:52:09 PST
(In reply to comment #2)
> (From update of attachment 226099 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=226099&action=review
> 
> GTK+ bits look good to me. I'll leave the rest to the WebKit2 owners.

Thanks for the review.

> > Source/WebKit2/WebProcess/WebPage/gtk/WebPrintOperationGtk.cpp:418
> > +void WebPrintOperationGtk::disconnectFromPage()
> 
> Maybe call this didDisconnectFromPage or notifyDisconnectFromPage since the disconnection actually happens earlier?

I followed other similar existing methods that are disconnectFromPage. This happens when the page is closed, and is telling the print operation to disconnect from the page. It's consistent with WebColorChooser::disconnectFromPage(), WebPopupMenu::disconnectFromPage(), WebOpenPanelResultListener::disconnectFromPage(), etc.
Comment 4 Carlos Garcia Campos 2014-03-12 11:27:08 PDT
Committed r165489: <http://trac.webkit.org/changeset/165489>