[Webkit-unassigned] [Bug 126979] [GTK] Web process sometimes crashes when printing in synchronous mode

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jan 15 04:58:55 PST 2014


https://bugs.webkit.org/show_bug.cgi?id=126979





--- Comment #3 from Carlos Garcia Campos <cgarcia at igalia.com>  2014-01-15 04:56:31 PST ---
(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).

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list