Bug 196542 - [GTK] gtk_print_settings_to_key_file: assertion 'GTK_IS_PRINT_SETTINGS (settings)' failed
Summary: [GTK] gtk_print_settings_to_key_file: assertion 'GTK_IS_PRINT_SETTINGS (setti...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Claudio Saavedra
URL:
Keywords: InRadar
: 225921 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-04-03 09:19 PDT by Diego Pino
Modified: 2022-04-15 04:42 PDT (History)
4 users (show)

See Also:


Attachments
Patch (5.58 KB, patch)
2022-04-14 05:04 PDT, Claudio Saavedra
no flags Details | Formatted Diff | Diff
Patch (3.75 KB, patch)
2022-04-14 05:06 PDT, Claudio Saavedra
no flags Details | Formatted Diff | Diff
Patch (121.19 KB, patch)
2022-04-14 06:38 PDT, Claudio Saavedra
aperez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Pino 2019-04-03 09:19:30 PDT
The following tests started to crash or timing out in GTK since r243762 ([WK2] Add support for Window's beforeprint / afterprint events https://bugs.webkit.org/show_bug.cgi?id=196478):

- printing/printing-events.html (new test introduced in r243762)
- printing/crash-while-formatting-subframe-for-printing.html

Other tests were reported as crashing after this changeset too:

- printing/print-close-crash.html
- fast/media/print-restores-previous-mediatype.html
- editing/execCommand/print.html
Comment 1 Diego Pino 2020-06-18 06:15:46 PDT
These two tests are now only crashing:

printing/crash-while-formatting-subframe-for-printing.html [ Crash ]
printing/printing-events.html [ Crash ]

printing/crash-while-formatting-subframe-for-printing-crash-log.txt:

Thread 1 (Thread 0x7f491fc92e80 (LWP 78)):
#0  0x00007f492c459ee5 in _g_log_abort (breakpoint=1) at ../glib/gmessages.c:554
#1  0x00007f492c45b1c9 in g_logv (log_domain=0x7f492160e133 "Gtk", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7ffec7b876e0) at ../glib/gmessages.c:1373
#2  0x00007f492c45b393 in g_log (log_domain=log_domain@entry=0x7f492160e133 "Gtk", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7f492c4ac77f "%s: assertion '%s' failed") at ../glib/gmessages.c:1415
#3  0x00007f492c45bb8d in g_return_if_fail_warning (log_domain=log_domain@entry=0x7f492160e133 "Gtk", pretty_function=pretty_function@entry=0x7f4921660830 <__func__.43115> "gtk_print_settings_to_key_file", expression=expression@entry=0x7f49216607d0 "GTK_IS_PRINT_SETTINGS (settings)") at ../glib/gmessages.c:2771
#4  0x00007f4921434ef2 in gtk_print_settings_to_key_file (settings=<optimized out>, key_file=<optimized out>, group_name=<optimized out>) at ../gtk/gtkprintsettings.c:1931
#5  0x00007f492898a719 in IPC::encode(IPC::Encoder&, _GtkPrintSettings*) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#6  0x00007f4928911d0a in WebKit::PrintInfo::encode(IPC::Encoder&) const () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#7  0x00007f4928a01038 in WebKit::WebPageProxy::beginPrinting(WebKit::WebFrameProxy*, WebKit::PrintInfo const&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#8  0x00007f4928a82eec in WKPageBeginPrinting () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#9  0x0000560503af7164 in WTR::printFrame(OpaqueWKPage const*, OpaqueWKFrame const*, void const*) ()
#10 0x00007f4928a7bc94 in WKPageSetPageUIClient::UIClient::printFrame(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WTF::CompletionHandler<void ()>&&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#11 0x00007f49289e6046 in WebKit::WebPageProxy::printFrame(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WTF::CompletionHandler<void ()>&&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#12 0x00007f492866e386 in WebKit::WebPageProxy::didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder, std::default_delete<IPC::Encoder> >&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#13 0x00007f49288f712b in IPC::MessageReceiverMap::dispatchSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder, std::default_delete<IPC::Encoder> >&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#14 0x00007f49289e3ed0 in non-virtual thunk to WebKit::WebProcessProxy::didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder, std::default_delete<IPC::Encoder> >&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#15 0x00007f49288f146d in IPC::Connection::dispatchSyncMessage(IPC::Decoder&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#16 0x00007f49288f1526 in IPC::Connection::dispatchMessage(std::unique_ptr<IPC::Decoder, std::default_delete<IPC::Decoder> >) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#17 0x00007f49288f198e in IPC::Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection(IPC::Connection&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#18 0x00007f492636d209 in WTF::RunLoop::performWork() () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#19 0x00007f49263d2019 in WTF::RunLoop::RunLoop()::{lambda(void*)#1}::_FUN(void*) () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#20 0x00007f492c453c3e in g_main_dispatch (context=0x56050499f1f0) at ../glib/gmain.c:3309
#21 0x00007f492c453c3e in g_main_context_dispatch (context=context@entry=0x56050499f1f0) at ../glib/gmain.c:3974
#22 0x00007f492c453ff0 in g_main_context_iterate (context=0x56050499f1f0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4047
#23 0x00007f492c4542e3 in g_main_loop_run (loop=0x560504ee3e90) at ../glib/gmain.c:4241
#24 0x00007f49263d2b20 in WTF::RunLoop::run() () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#25 0x0000560503b338a1 in WTR::TestController::platformRunUntil(bool&, WTF::Seconds) ()
#26 0x0000560503b1a411 in WTR::TestInvocation::invoke() ()
#27 0x0000560503b07562 in WTR::TestController::runTest(char const*) ()
#28 0x0000560503b080bf in WTR::TestController::runTestingServerLoop() ()
#29 0x0000560503b08468 in WTR::TestController::TestController(int, char const**) ()
#30 0x0000560503af0f86 in main ()

STDERR:
STDERR: warning: core file may not match specified executable file.
STDERR:
STDERR: (WebKitTestRunner:78): Gtk-CRITICAL **: 06:09:28.797: gtk_print_settings_to_key_file: assertion 'GTK_IS_PRINT_SETTINGS (settings)' failed

printing/printing-events-crash-log.txt:

Thread 1 (Thread 0x7fd11a32fe80 (LWP 439)):
#0  0x00007fd126af6ee5 in _g_log_abort (breakpoint=1) at ../glib/gmessages.c:554
#1  0x00007fd126af81c9 in g_logv (log_domain=0x7fd11bcab133 "Gtk", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=args@entry=0x7ffc98a42810) at ../glib/gmessages.c:1373
#2  0x00007fd126af8393 in g_log (log_domain=log_domain@entry=0x7fd11bcab133 "Gtk", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7fd126b4977f "%s: assertion '%s' failed") at ../glib/gmessages.c:1415
#3  0x00007fd126af8b8d in g_return_if_fail_warning (log_domain=log_domain@entry=0x7fd11bcab133 "Gtk", pretty_function=pretty_function@entry=0x7fd11bcfd830 <__func__.43115> "gtk_print_settings_to_key_file", expression=expression@entry=0x7fd11bcfd7d0 "GTK_IS_PRINT_SETTINGS (settings)") at ../glib/gmessages.c:2771
#4  0x00007fd11bad1ef2 in gtk_print_settings_to_key_file (settings=<optimized out>, key_file=<optimized out>, group_name=<optimized out>) at ../gtk/gtkprintsettings.c:1931
#5  0x00007fd123027719 in IPC::encode(IPC::Encoder&, _GtkPrintSettings*) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#6  0x00007fd122faed0a in WebKit::PrintInfo::encode(IPC::Encoder&) const () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#7  0x00007fd12309e038 in WebKit::WebPageProxy::beginPrinting(WebKit::WebFrameProxy*, WebKit::PrintInfo const&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#8  0x00007fd12311feec in WKPageBeginPrinting () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#9  0x0000558b85c02164 in WTR::printFrame(OpaqueWKPage const*, OpaqueWKFrame const*, void const*) ()
#10 0x00007fd123118c94 in WKPageSetPageUIClient::UIClient::printFrame(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WTF::CompletionHandler<void ()>&&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#11 0x00007fd123083046 in WebKit::WebPageProxy::printFrame(WTF::ObjectIdentifier<WebCore::FrameIdentifierType>, WTF::CompletionHandler<void ()>&&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#12 0x00007fd122d0b386 in WebKit::WebPageProxy::didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder, std::default_delete<IPC::Encoder> >&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#13 0x00007fd122f9412b in IPC::MessageReceiverMap::dispatchSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder, std::default_delete<IPC::Encoder> >&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#14 0x00007fd123080ed0 in non-virtual thunk to WebKit::WebProcessProxy::didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder, std::default_delete<IPC::Encoder> >&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#15 0x00007fd122f8e46d in IPC::Connection::dispatchSyncMessage(IPC::Decoder&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#16 0x00007fd122f8e526 in IPC::Connection::dispatchMessage(std::unique_ptr<IPC::Decoder, std::default_delete<IPC::Decoder> >) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#17 0x00007fd122f8e98e in IPC::Connection::SyncMessageState::dispatchMessagesAndResetDidScheduleDispatchMessagesForConnection(IPC::Connection&) () at /app/webkit/WebKitBuild/Release/lib/libwebkit2gtk-4.0.so.37
#18 0x00007fd120a0a209 in WTF::RunLoop::performWork() () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#19 0x00007fd120a6f019 in WTF::RunLoop::RunLoop()::{lambda(void*)#1}::_FUN(void*) () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#20 0x00007fd126af0c3e in g_main_dispatch (context=0x558b85ebfb90) at ../glib/gmain.c:3309
#21 0x00007fd126af0c3e in g_main_context_dispatch (context=context@entry=0x558b85ebfb90) at ../glib/gmain.c:3974
#22 0x00007fd126af0ff0 in g_main_context_iterate (context=0x558b85ebfb90, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4047
#23 0x00007fd126af12e3 in g_main_loop_run (loop=0x558b864065c0) at ../glib/gmain.c:4241
#24 0x00007fd120a6fb20 in WTF::RunLoop::run() () at /app/webkit/WebKitBuild/Release/lib/libjavascriptcoregtk-4.0.so.18
#25 0x0000558b85c3e8a1 in WTR::TestController::platformRunUntil(bool&, WTF::Seconds) ()
#26 0x0000558b85c25411 in WTR::TestInvocation::invoke() ()
#27 0x0000558b85c12562 in WTR::TestController::runTest(char const*) ()
#28 0x0000558b85c130bf in WTR::TestController::runTestingServerLoop() ()
#29 0x0000558b85c13468 in WTR::TestController::TestController(int, char const**) ()
#30 0x0000558b85bfbf86 in main ()

STDERR:
STDERR: warning: core file may not match specified executable file.
STDERR:
STDERR: (WebKitTestRunner:439): Gtk-CRITICAL **: 06:09:44.410: gtk_print_settings_to_key_file: assertion 'GTK_IS_PRINT_SETTINGS (settings)' failed
Comment 2 Claudio Saavedra 2022-04-14 04:51:10 PDT
The problem is that the test runner is calling WKPageBeginPrinting() with a WKPrintInfo struct that gets converted to a WebKit::PrintInfo by calling printInfoFromWKPrintInfo(), but this method doesn't fill the GtkPrintSettings and GtkPageSetup members in the struct, so these remain null, because they don't have 
a default initial value. Then the encoder is assuming that these are non null, and calling GTK API on them, and the GTK API fails with a critical because they are NULL.

So either printInfoFromWKPrintInfo() needs to fill these members for the GTK port, or the encoder shouldn't assume that these members are non null, or they should be default-initialized.
Comment 3 Claudio Saavedra 2022-04-14 04:59:41 PDT
*** Bug 225921 has been marked as a duplicate of this bug. ***
Comment 4 Claudio Saavedra 2022-04-14 05:04:01 PDT
Created attachment 457611 [details]
Patch
Comment 5 Claudio Saavedra 2022-04-14 05:06:52 PDT
Created attachment 457612 [details]
Patch
Comment 6 Claudio Saavedra 2022-04-14 06:38:57 PDT
Created attachment 457621 [details]
Patch
Comment 7 Claudio Saavedra 2022-04-15 04:42:01 PDT
Committed r292904 (?): <https://commits.webkit.org/r292904>
Comment 8 Radar WebKit Bug Importer 2022-04-15 04:42:15 PDT
<rdar://problem/91803429>