Bug 32879 - [GTK] Only load dictionaries if spell check is enabled
Summary: [GTK] Only load dictionaries if spell check is enabled
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
Keywords: Gtk
Depends on:
Reported: 2009-12-22 13:08 PST by Christian Dywan
Modified: 2011-06-02 10:16 PDT (History)
2 users (show)

See Also:

Proposed Patch (3.54 KB, patch)
2011-06-02 00:02 PDT, Joone Hur
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Dywan 2009-12-22 13:08:21 PST
Currently enchant dictionaries are loaded unconditionally for any new WebKitWebSettings, regardless of whether enable-spell-checking is enabled or not. This has two side effects: enchant is initialized even when not used. And the languages are loaded twice if the application changes spell-checking-languages before enabling spell checking.

I suggest the languages should only be initialized if spell checking is enabled. The dictionary loading should therefore be moved into a helper function and called as needed.
Comment 1 Joone Hur 2011-06-01 22:12:46 PDT
These is a case which WebKitGtk+ can't load dictionaries as follows:
(gdb) bt
#0  0x0012e416 in __kernel_vsyscall ()
#1  0x0409ee71 in raise () from /lib/i386-linux-gnu/libc.so.6
#2  0x040a234e in abort () from /lib/i386-linux-gnu/libc.so.6
#3  0x040d5577 in ?? () from /lib/i386-linux-gnu/libc.so.6
#4  0x04159df0 in __fortify_fail () from /lib/i386-linux-gnu/libc.so.6
#5  0x04158cca in __chk_fail () from /lib/i386-linux-gnu/libc.so.6
#6  0x0415805f in __strcpy_chk () from /lib/i386-linux-gnu/libc.so.6
#7  0x0437b412 in strcpy (this=0x80f0520, word=0x80f7090 "0", wbl=1, wcl=1, aff=0x80efd38, al=2, desc=0x0, onlyupcase=false) at /usr/include/bits/string3.h:105
#8  HashMgr::add_word (this=0x80f0520, word=0x80f7090 "0", wbl=1, wcl=1, aff=0x80efd38, al=2, desc=0x0, onlyupcase=false) at hashmgr.cxx:138
#9  0x0437bc6d in HashMgr::load_tables (this=0x80f0520, tpath=0x80eff38 "/home/joone/checkout/gnome/build/share/myspell/dicts/en_US.dic", key=0x0) at hashmgr.cxx:470
#10 0x0437becb in HashMgr::HashMgr (this=0x80f0520, tpath=0x80eff38 "/home/joone/checkout/gnome/build/share/myspell/dicts/en_US.dic", apath=0x80f0050 "/home/joone/checkout/gnome/build/share/myspell/dicts/en_US.aff", key=0x0)
    at hashmgr.cxx:52
#11 0x0437c233 in Hunspell::Hunspell (this=0x80f0160, affpath=0x80f0050 "/home/joone/checkout/gnome/build/share/myspell/dicts/en_US.aff", dpath=0x80eff38 "/home/joone/checkout/gnome/build/share/myspell/dicts/en_US.dic", key=0x0)
    at hunspell.cxx:34
#12 0x0438c2a9 in MySpellChecker::requestDictionary (this=0x80ec9e0, szLang=0x80f0328 "en_US") at myspell_checker.cpp:423
#13 0x0438c42f in myspell_provider_request_dict (me=0x80ecf78, tag=0x80f0328 "en_US") at myspell_checker.cpp:549
#14 0x02e5c745 in _enchant_broker_request_dict (broker=0x80ec4f0, tag=0x80f0328 "en_US") at enchant.c:1807
#15 0x02e5daf1 in enchant_broker_request_dict (broker=0x80ec4f0, tag=0x80c9fb4 "en-us") at enchant.c:1853
#16 0x009ebf43 in WebKit::TextCheckerClientEnchant::updateSpellCheckingLanguage (this=0x80b8198, spellCheckingLanguages=0x0) at ../../Source/WebKit/gtk/WebCoreSupport/TextCheckerClientEnchant.cpp:187
#17 0x00a414a3 in webkit_web_view_update_settings (webView=0x80b9020) at ../../Source/WebKit/gtk/webkit/webkitwebview.cpp:3292
#18 0x00a4257a in webkit_web_view_init (webView=0x80b9020) at ../../Source/WebKit/gtk/webkit/webkitwebview.cpp:3478
#19 0x038eb5a9 in g_type_create_instance (type=134919616) at gtype.c:1885
#20 0x038c7f65 in g_object_constructor (type=134919616, n_construct_properties=2, construct_params=0x80b6b58) at gobject.c:1615
#21 0x038caf64 in g_object_newv (object_type=134919616, n_parameters=0, parameters=0x0) at gobject.c:1479
#22 0x038cc330 in g_object_new (object_type=134919616, first_property_name=0x0) at gobject.c:1308
#23 0x00a42703 in webkit_web_view_new () at ../../Source/WebKit/gtk/webkit/webkitwebview.cpp:3491
#24 0x0804a1ce in createWindow (outWebView=0xbfffead0) at ../../Tools/GtkLauncher/main.c:202
#25 0x0804a3fe in main (argc=1, argv=0xbfffeba4) at ../../Tools/GtkLauncher/main.c:253
Comment 2 Joone Hur 2011-06-02 00:02:35 PDT
Created attachment 95730 [details]
Proposed Patch

This patch allows WebKitGtk+ to skip loading dictionaries when spell-checking is not enabled.
Comment 3 Martin Robinson 2011-06-02 08:10:52 PDT
Comment on attachment 95730 [details]
Proposed Patch

Comment 4 WebKit Commit Bot 2011-06-02 10:16:31 PDT
Comment on attachment 95730 [details]
Proposed Patch

Clearing flags on attachment: 95730

Committed r87925: <http://trac.webkit.org/changeset/87925>
Comment 5 WebKit Commit Bot 2011-06-02 10:16:36 PDT
All reviewed patches have been landed.  Closing bug.