Summary: | [GTK] Web process sometimes crashes when printing in synchronous mode | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Carlos Garcia Campos <cgarcia> | ||||
Component: | WebKit2 | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | andersca, bunhere, cdumez, commit-queue, gustavo, gyuyoung.kim, ltilve, rakuco | ||||
Priority: | P2 | Keywords: | Gtk | ||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | 126977 | ||||||
Bug Blocks: | |||||||
Attachments: |
|
Description
Carlos Garcia Campos
2014-01-14 05:19:34 PST
Created attachment 221254 [details]
Patch
Comment on attachment 221254 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=221254&action=review LGTM, only a few questions to ensure I understood the life-cycle of the printer list correctly. > Source/WebKit2/ChangeLog:12 > + UI process like EndPrinting. When the EndPriting message is Readability would be improved by using longer lines and/or splitting in paragraphs, I think. > Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp:610 > + RefPtr<PrinterListGtk> printerList = PrinterListGtk::shared(); Do I understand correctly that the printer list is kept alive by this reference, but is destroyed afterwards? I was a bit concerned when I saw PrinterListGtk::s_sharedPrinterList, since that could mean the printer list would only be obtained once, but I think I understand the idea now. > Source/WebKit2/WebProcess/WebPage/gtk/PrinterListGtk.h:53 > + Vector<GRefPtr<GtkPrinter>, 4> m_printerList; Any particular reason for using 4 here? (In reply to comment #2) > (From update of attachment 221254 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=221254&action=review > > LGTM, only a few questions to ensure I understood the life-cycle of the printer list correctly. Thanks! > > Source/WebKit2/ChangeLog:12 > > + UI process like EndPrinting. When the EndPriting message is > > Readability would be improved by using longer lines and/or splitting in paragraphs, I think. my emacs. . . > > Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp:610 > > + RefPtr<PrinterListGtk> printerList = PrinterListGtk::shared(); > > Do I understand correctly that the printer list is kept alive by this reference, but is destroyed afterwards? I was a bit concerned when I saw PrinterListGtk::s_sharedPrinterList, since that could mean the printer list would only be obtained once, but I think I understand the idea now. Yes, it's tricky. The thing is that for sync printing, we need to make sure that the PrinterList object has already been created, for async printing the PrinterList object is created in WebPrintOperationGtk::startPrint(). The shared method returns a RefPtr, but when created the reference is adopted. So what happens is the following: Sync printing: WebChromeClient::print() -> creates the PrinterList WebPrintOperationGtk::startPrint() -> gets a ref of the existing PrinterList WebPrintOperationGtk::startPrint() -> releases its ref WebChromeClient::print() -> PrinterList is destroyed Async printing: WebPrintOperationGtk::startPrint() -> creates the PrinterList WebPrintOperationGtk::startPrint() -> PrinterList is destroyed > > Source/WebKit2/WebProcess/WebPage/gtk/PrinterListGtk.h:53 > > + Vector<GRefPtr<GtkPrinter>, 4> m_printerList; > > Any particular reason for using 4 here? Nope, I assumed there are usually less than 4 printers (print to file, real printer and possibly a cups-pdf virtual printer). Adding wk2 owner because of the change in WebChromeClient (In reply to comment #3) > > > Source/WebKit2/ChangeLog:12 > > > + UI process like EndPrinting. When the EndPriting message is > > > > Readability would be improved by using longer lines and/or splitting in paragraphs, I think. > > my emacs. . . Mx- set-fill-column <RET> 92 <RET> \o/ =) > > Do I understand correctly that the printer list is kept alive by this reference, but is destroyed afterwards? I was a bit concerned when I saw PrinterListGtk::s_sharedPrinterList, since that could mean the printer list would only be obtained once, but I think I understand the idea now. > > Yes, it's tricky. The thing is that for sync printing, we need to make sure that the PrinterList object has already … Makes sense, thanks! Committed r162073: <http://trac.webkit.org/changeset/162073> |