<?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>156972</bug_id>
          
          <creation_ts>2016-04-25 04:49:42 -0700</creation_ts>
          <short_desc>[GTK] Crashes if DISPLAY is unset</short_desc>
          <delta_ts>2016-04-25 13:47:47 -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>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>http://bugs.debian.org/803104</see_also>
    
    <see_also>https://bugzilla.gnome.org/show_bug.cgi?id=757061</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Alberto Garcia">berto</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>bugs-noreply</cc>
    
    <cc>cgarcia</cc>
    
    <cc>kapouer</cc>
    
    <cc>mcatanzaro</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1186903</commentid>
    <comment_count>0</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2016-04-25 04:49:42 -0700</bug_when>
    <thetext>This happens when the gtk-doc scanner is linked against webkit2gtk:

gtkdoc-scangobj  $scanobj_options --module=libyelp

(process:14998): Gtk-CRITICAL **: gtk_icon_theme_get_for_screen: assertion &apos;GDK_IS_SCREEN (screen)&apos; failed

** (process:14998): WARNING **: Unable to connect to dbus: Cannot autolaunch D-Bus without X11 $DISPLAY
Segmentation fault

The segfault comes from webkitgtk:

(gdb) bt
#0  XCloseDisplay (dpy=0x0) at ../../src/ClDisplay.c:51
#1  0x00007ffff4eab831 in WebCore::PlatformDisplayX11::~PlatformDisplayX11 (this=0x7fffe2dfc028, __in_chrg=&lt;optimized out&gt;)
    at /build/webkit2gtk-ea7lQt/webkit2gtk-2.12.1/Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp:53

The problem seems to be that m_display is initialized in the constructor of PlatformDisplayX11, but it&apos;s assumed not to be NULL.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1186904</commentid>
    <comment_count>1</comment_count>
      <attachid>277239</attachid>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2016-04-25 04:53:58 -0700</bug_when>
    <thetext>Created attachment 277239
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1186908</commentid>
    <comment_count>2</comment_count>
      <attachid>277239</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2016-04-25 05:31:11 -0700</bug_when>
    <thetext>Comment on attachment 277239
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277239&amp;action=review

&gt; Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp:52
&gt; -    if (m_ownedDisplay)
&gt; +    if (m_ownedDisplay &amp;&amp; m_display)

what about initializing m_ownedDisplay to false if display is NULL? we can&apos;t own a display that doesn&apos;t exist.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1186928</commentid>
    <comment_count>3</comment_count>
      <attachid>277247</attachid>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2016-04-25 07:37:46 -0700</bug_when>
    <thetext>Created attachment 277247
Patch

Ok, I chose to initialize m_ownedDisplay in the body of the constructor to make sure that m_display is set first. Otherwise we&apos;d have to rely on the order in which m_display and m_ownedDisplay are declared in the class definition.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1186934</commentid>
    <comment_count>4</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2016-04-25 08:08:49 -0700</bug_when>
    <thetext>(In reply to comment #3)
&gt; Created attachment 277247 [details]
&gt; Patch
&gt; 
&gt; Ok, I chose to initialize m_ownedDisplay in the body of the constructor to
&gt; make sure that m_display is set first. Otherwise we&apos;d have to rely on the
&gt; order in which m_display and m_ownedDisplay are declared in the class
&gt; definition.

Isn&apos;t the order ensured by the compiler? why do we have a warning when the order in the list doesn&apos;t match the one in the declaration, then?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1186935</commentid>
    <comment_count>5</comment_count>
      <attachid>277247</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2016-04-25 08:10:11 -0700</bug_when>
    <thetext>Comment on attachment 277247
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=277247&amp;action=review

&gt; Source/WebCore/platform/graphics/x11/PlatformDisplayX11.cpp:41
&gt; +    m_ownedDisplay = m_display != nullptr;

We don&apos;t explicitly check nullptr, m_ownedDisplay = m_display; should just work, I think.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1186974</commentid>
    <comment_count>6</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2016-04-25 10:26:08 -0700</bug_when>
    <thetext>(In reply to comment #4) 
&gt; Isn&apos;t the order ensured by the compiler? why do we have a warning when the
&gt; order in the list doesn&apos;t match the one in the declaration, then?

Member variables are always initialized in the order they are declared in the class, NOT the order they are listed in the initializer list. Putting them out of order in the initializer list is thus very confusing, and worth warning about. We should never do that in WebKit.

Since relying on the order of declarations is risky -- someone could easily swap those in a &quot;cleanup&quot; and not notice the warning -- I agree with Berto that it&apos;s a good idea to do the assignment in the body of the constructor.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1187044</commentid>
    <comment_count>7</comment_count>
    <who name="Alberto Garcia">berto</who>
    <bug_when>2016-04-25 13:47:47 -0700</bug_when>
    <thetext>Committed r200046: &lt;http://trac.webkit.org/changeset/200046&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>277239</attachid>
            <date>2016-04-25 04:53:58 -0700</date>
            <delta_ts>2016-04-25 07:37:46 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>156972.diff</filename>
            <type>text/plain</type>
            <size>1295</size>
            <attacher name="Alberto Garcia">berto</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZwppbmRleCAxOTc2MGIyLi5jMDkyYmY4IDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViQ29y
ZS9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTYg
QEAKKzIwMTYtMDQtMjUgIEFsYmVydG8gR2FyY2lhICA8YmVydG9AaWdhbGlhLmNvbT4KKworICAg
ICAgICBbR1RLXSBDcmFzaGVzIGlmIERJU1BMQVkgaXMgdW5zZXQKKyAgICAgICAgaHR0cHM6Ly9i
dWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTE1Njk3MgorCisgICAgICAgIFJldmlld2Vk
IGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIElmIERJU1BMQVkgaXMgdW5zZXQgdGhlbiBt
X2Rpc3BsYXkgd2lsbCBiZSBOVUxMLCBjcmFzaGluZyBXZWJLaXQKKyAgICAgICAgd2hlbiBYQ2xv
c2VEaXNwbGF5IGlzIGNhbGxlZCBpbiB0aGUgUGxhdGZvcm1EaXNwbGF5WDExIGRlc3RydWN0b3Iu
CisKKyAgICAgICAgKiBwbGF0Zm9ybS9ncmFwaGljcy94MTEvUGxhdGZvcm1EaXNwbGF5WDExLmNw
cDoKKyAgICAgICAgKFdlYkNvcmU6OlBsYXRmb3JtRGlzcGxheVgxMTo6flBsYXRmb3JtRGlzcGxh
eVgxMSk6CisKIDIwMTYtMDQtMjUgIFlvdWVubiBGYWJsZXQgIDx5b3Vlbm4uZmFibGV0QGNyZi5j
YW5vbi5mcj4KIAogICAgICAgICBEcm9wIFtVc2VQb2ludGVyc0V2ZW5Gb3JOb25OdWxsYWJsZU9i
amVjdEFyZ3VtZW50c10gZnJvbSBUZXh0VHJhY2sKZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3Jl
L3BsYXRmb3JtL2dyYXBoaWNzL3gxMS9QbGF0Zm9ybURpc3BsYXlYMTEuY3BwIGIvU291cmNlL1dl
YkNvcmUvcGxhdGZvcm0vZ3JhcGhpY3MveDExL1BsYXRmb3JtRGlzcGxheVgxMS5jcHAKaW5kZXgg
OTdjODcyZC4uMWM0MGU3YzQgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJDb3JlL3BsYXRmb3JtL2dy
YXBoaWNzL3gxMS9QbGF0Zm9ybURpc3BsYXlYMTEuY3BwCisrKyBiL1NvdXJjZS9XZWJDb3JlL3Bs
YXRmb3JtL2dyYXBoaWNzL3gxMS9QbGF0Zm9ybURpc3BsYXlYMTEuY3BwCkBAIC00OSw3ICs0OSw3
IEBAIFBsYXRmb3JtRGlzcGxheVgxMTo6UGxhdGZvcm1EaXNwbGF5WDExKERpc3BsYXkqIGRpc3Bs
YXkpCiAKIFBsYXRmb3JtRGlzcGxheVgxMTo6flBsYXRmb3JtRGlzcGxheVgxMSgpCiB7Ci0gICAg
aWYgKG1fb3duZWREaXNwbGF5KQorICAgIGlmIChtX293bmVkRGlzcGxheSAmJiBtX2Rpc3BsYXkp
CiAgICAgICAgIFhDbG9zZURpc3BsYXkobV9kaXNwbGF5KTsKIH0KIAo=
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>277247</attachid>
            <date>2016-04-25 07:37:46 -0700</date>
            <delta_ts>2016-04-25 08:10:11 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>156972.diff</filename>
            <type>text/plain</type>
            <size>1328</size>
            <attacher name="Alberto Garcia">berto</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3JlL0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJDb3JlL0No
YW5nZUxvZwppbmRleCAxOTc2MGIyLi5jMDkyYmY4IDEwMDY0NAotLS0gYS9Tb3VyY2UvV2ViQ29y
ZS9DaGFuZ2VMb2cKKysrIGIvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMTYg
QEAKKzIwMTYtMDQtMjUgIEFsYmVydG8gR2FyY2lhICA8YmVydG9AaWdhbGlhLmNvbT4KKworICAg
ICAgICBbR1RLXSBDcmFzaGVzIGlmIERJU1BMQVkgaXMgdW5zZXQKKyAgICAgICAgaHR0cHM6Ly9i
dWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTE1Njk3MgorCisgICAgICAgIFJldmlld2Vk
IGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIElmIERJU1BMQVkgaXMgdW5zZXQgdGhlbiBt
X2Rpc3BsYXkgd2lsbCBiZSBOVUxMLCBjcmFzaGluZyBXZWJLaXQKKyAgICAgICAgd2hlbiBYQ2xv
c2VEaXNwbGF5IGlzIGNhbGxlZCBpbiB0aGUgUGxhdGZvcm1EaXNwbGF5WDExIGRlc3RydWN0b3Iu
CisKKyAgICAgICAgKiBwbGF0Zm9ybS9ncmFwaGljcy94MTEvUGxhdGZvcm1EaXNwbGF5WDExLmNw
cDoKKyAgICAgICAgKFdlYkNvcmU6OlBsYXRmb3JtRGlzcGxheVgxMTo6flBsYXRmb3JtRGlzcGxh
eVgxMSk6CisKIDIwMTYtMDQtMjUgIFlvdWVubiBGYWJsZXQgIDx5b3Vlbm4uZmFibGV0QGNyZi5j
YW5vbi5mcj4KIAogICAgICAgICBEcm9wIFtVc2VQb2ludGVyc0V2ZW5Gb3JOb25OdWxsYWJsZU9i
amVjdEFyZ3VtZW50c10gZnJvbSBUZXh0VHJhY2sKZGlmZiAtLWdpdCBhL1NvdXJjZS9XZWJDb3Jl
L3BsYXRmb3JtL2dyYXBoaWNzL3gxMS9QbGF0Zm9ybURpc3BsYXlYMTEuY3BwIGIvU291cmNlL1dl
YkNvcmUvcGxhdGZvcm0vZ3JhcGhpY3MveDExL1BsYXRmb3JtRGlzcGxheVgxMS5jcHAKaW5kZXgg
OTdjODcyZC4uOTY2YWNkNiAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvcGxhdGZvcm0vZ3Jh
cGhpY3MveDExL1BsYXRmb3JtRGlzcGxheVgxMS5jcHAKKysrIGIvU291cmNlL1dlYkNvcmUvcGxh
dGZvcm0vZ3JhcGhpY3MveDExL1BsYXRmb3JtRGlzcGxheVgxMS5jcHAKQEAgLTM3LDggKzM3LDgg
QEAgbmFtZXNwYWNlIFdlYkNvcmUgewogCiBQbGF0Zm9ybURpc3BsYXlYMTE6OlBsYXRmb3JtRGlz
cGxheVgxMSgpCiAgICAgOiBtX2Rpc3BsYXkoWE9wZW5EaXNwbGF5KG51bGxwdHIpKQotICAgICwg
bV9vd25lZERpc3BsYXkodHJ1ZSkKIHsKKyAgICBtX293bmVkRGlzcGxheSA9IG1fZGlzcGxheSAh
PSBudWxscHRyOwogfQogCiBQbGF0Zm9ybURpc3BsYXlYMTE6OlBsYXRmb3JtRGlzcGxheVgxMShE
aXNwbGF5KiBkaXNwbGF5KQo=
</data>
<flag name="review"
          id="301472"
          type_id="1"
          status="+"
          setter="cgarcia"
    />
          </attachment>
      

    </bug>

</bugzilla>