<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>19813</bug_id>
          
          <creation_ts>2008-06-29 07:31:11 -0700</creation_ts>
          <short_desc>[GTK] WebKit crashes on invalid settings notify callback</short_desc>
          <delta_ts>2008-07-17 04:53:58 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKitGTK</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Gtk</keywords>
          <priority>P2</priority>
          <bug_severity>Major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Christian Dywan">christian</reporter>
          <assigned_to name="Christian Dywan">christian</assigned_to>
          <cc>alp</cc>
    
    <cc>jmalonzo</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84708</commentid>
    <comment_count>0</comment_count>
    <who name="Christian Dywan">christian</who>
    <bug_when>2008-06-29 07:31:11 -0700</bug_when>
    <thetext>A bug reported for Midori [1] is in fact also a bug in WebKit. The WebView connects a notify callback for its WebSettings. But this callback isn&apos;t disconnected when the WebView is finalized which means that the callback is still emitted but the, by then destroyed, web view is invalid.

[1] http://software.twotoasts.de/bugs/index.php?do=details&amp;task_id=15&amp;project=0</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84709</commentid>
    <comment_count>1</comment_count>
      <attachid>21996</attachid>
    <who name="Christian Dywan">christian</who>
    <bug_when>2008-06-29 07:37:23 -0700</bug_when>
    <thetext>Created attachment 21996
Disconnect notify callback on finalize</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84821</commentid>
    <comment_count>2</comment_count>
    <who name="Alp Toker">alp</who>
    <bug_when>2008-06-30 23:12:28 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; Created an attachment (id=21996) [edit]
&gt; Disconnect notify callback on finalize
&gt; 

Would it be cleaner to re-use webkit_web_view_set_settings() for this purpose?

If we change webkit_web_view_set_settings() to accept a NULL WebKitWebSettings*, it already has the code to disconnect the signal, unref etc. This would allow developers using the API to disassociate the WebView from WebSettings too using the same code path.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85131</commentid>
    <comment_count>3</comment_count>
    <who name="Christian Dywan">christian</who>
    <bug_when>2008-07-03 15:48:07 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (In reply to comment #1)
&gt; &gt; Created an attachment (id=21996) [edit]
&gt; &gt; Disconnect notify callback on finalize
&gt; &gt; 
&gt; 
&gt; Would it be cleaner to re-use webkit_web_view_set_settings() for this purpose?
&gt; 
&gt; If we change webkit_web_view_set_settings() to accept a NULL
&gt; WebKitWebSettings*, it already has the code to disconnect the signal, unref
&gt; etc. This would allow developers using the API to disassociate the WebView from
&gt; WebSettings too using the same code path.

I thought about this for a bit. I tend to think that&apos;s not really useful. Basically the view will always need some kind of WebSettings instance. That means if you could unset it via _set_settings (view, NULL), the view would have two options to cope with this:

a) Unref the old settings and disconnect notify. Then essentially enter an undefined state.

b) Unref the old settings, disconnect notify and immeditately create a new settings instance with default values. The state is &apos;back to defaults&apos;

I don&apos;t find either option too attractive.

This is my estimation. If you, or anyone for that matter, have a use case I will probably not mind to add something in this direction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86073</commentid>
    <comment_count>4</comment_count>
      <attachid>21996</attachid>
    <who name="Holger Freyther">zecke</who>
    <bug_when>2008-07-16 11:02:14 -0700</bug_when>
    <thetext>Comment on attachment 21996
Disconnect notify callback on finalize

Looks sensible.

I only wonder about the (gpointer) G_CALLBACK() mix in regard to handling this callback in the various methods but I have not checked if I we get compile warnings when always using G_CALLBACK...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86201</commentid>
    <comment_count>5</comment_count>
      <attachid>21996</attachid>
    <who name="Christian Dywan">christian</who>
    <bug_when>2008-07-17 04:53:37 -0700</bug_when>
    <thetext>Comment on attachment 21996
Disconnect notify callback on finalize

(In reply to comment #4)
&gt; (From update of attachment 21996 [edit])
&gt; Looks sensible.
&gt; 
&gt; I only wonder about the (gpointer) G_CALLBACK() mix in regard to handling this
&gt; callback in the various methods but I have not checked if I we get compile
&gt; warnings when always using G_CALLBACK...

We can&apos;t use G_CALLBACK() when disconnecting the handler, since that unfortunately breaks with the compiler saying that it can&apos;t cast »void (*)()« to »void*«.

Committed in revision 35219.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>21996</attachid>
            <date>2008-06-29 07:37:23 -0700</date>
            <delta_ts>2008-07-17 04:53:37 -0700</delta_ts>
            <desc>Disconnect notify callback on finalize</desc>
            <filename>webviewnotify.diff</filename>
            <type>text/plain</type>
            <size>1064</size>
            <attacher name="Christian Dywan">christian</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYktpdC9ndGsvd2Via2l0L3dlYmtpdHdlYnZpZXcuY3BwIGIvV2ViS2l0
L2d0ay93ZWJraXQvd2Via2l0d2Vidmlldy5jcHAKaW5kZXggNmE3ZWExZi4uYjllYzYxNyAxMDA2
NDQKLS0tIGEvV2ViS2l0L2d0ay93ZWJraXQvd2Via2l0d2Vidmlldy5jcHAKKysrIGIvV2ViS2l0
L2d0ay93ZWJraXQvd2Via2l0d2Vidmlldy5jcHAKQEAgLTEwOCw2ICsxMDgsOCBAQCBzdGF0aWMg
Z3VpbnQgd2Via2l0X3dlYl92aWV3X3NpZ25hbHNbTEFTVF9TSUdOQUx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