Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-7985

Crash in libXft due to incorrect bookkeeping of what needs to be deleted in TGX11TFF.cxx (includes suggested patch)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 6.06/00
    • Fix Version/s: None
    • Component/s: Graphics
    • Labels:
      None
    • Environment:

      Ubuntu 14.04

      Description

      Hello,

      Having "X11.UseXft: yes" activated in my .rootrc file and running this little program, results in a crash (segmentation violation).

      include <iostream>
      using namespace std;
       
      // ROOT
      #include <TApplication.h>
      #include <TGClient.h>
       
      int main()
      {
        TApplication App("MyApp", 0, 0);
           
        if (gClient != 0 && gClient->GetRoot() != 0) {
          cout<<"This is just for testing to provoke a crash..."<<endl;
        }
             
        cout<<"Get ready to crash:"<<endl;
               
        return 0;
      }

      I compile it with:

      g++ `root-config --cflags` CrashOnExit.cxx `root-config --glibs` -o CrashOnExit

      Running it, gives me the following crash:

      #5  XftFontManageMemory (dpy=dpy
      entry=0x31afe70) at ../../src/xftfreetype.c:1115
      #6  0x00007ff5b64eaa27 in _XftCloseDisplay (dpy=0x31afe70, codes=<optimized out>) at ../../src/xftdpy.c:40
      #7  0x00007ff5b73714b2 in XCloseDisplay () from /usr/lib/x86_64-linux-gnu/libX11.so.6
      #8  0x00007ff5b76cce00 in TGX11::CloseDisplay (this=0x30e6650) at /home/andreas/Home/Science/Software/External/root_v6.06.00/root_v6.06.00-source/graf2d/x11/src/GX11Gui.cxx:856
      #9  0x00007ff5c39e4a2a in TGClient::~TGClient (this=0x31115f0, __in_chrg=<optimized out>) at /home/andreas/Home/Science/Software/External/root_v6.06.00/root_v6.06.00-source/gui/gui/src/TGClient.cxx:632
      #10 0x00007ff5c39e4a59 in TGClient::~TGClient (this=0x31115f0, __in_chrg=<optimized out>) at /home/andreas/Home/Science/Software/External/root_v6.06.00/root_v6.06.00-source/gui/gui/src/TGClient.cxx:634
      #11 0x00007ff5c3ab8d5f in TRootApplication::~TRootApplication (this=0x30f3960, __in_chrg=<optimized out>) at /home/andreas/Home/Science/Software/External/root_v6.06.00/root_v6.06.00-source/gui/gui/src/TRootApplication.cxx:60
      #12 0x00007ff5c3ab8d89 in TRootApplication::~TRootApplication (this=0x30f3960, __in_chrg=<optimized out>) at /home/andreas/Home/Science/Software/External/root_v6.06.00/root_v6.06.00-source/gui/gui/src/TRootApplication.cxx:61
      #13 0x00007ff5c339e557 in TApplication::~TApplication (this=0x7ffcbacc5440, __in_chrg=<optimized out>) at /home/andreas/Home/Science/Software/External/root_v6.06.00/root_v6.06.00-source/core/base/src/TApplication.cxx:240
      #14 0x00000000004016aa in main ()

      Looking into the source code of TGX11TFF.cxx, it becomes clear, that the class does not correctly keep track of which fonts need to be deleted, and therefore some fonts get deleted multiple times resulting in the crash.

      Attached is a patch suggestion (for 6.06/00), which does no longer cause the crashes.

      Thanks a lot,
      Andreas

      PS: I am fully aware that this is a duplicate of
      https://sft.its.cern.ch/jira/browse/ROOT-7675
      but this thread seems to be too overloaded for the solution I posted there 3 month ago to be noticed... ;-(

        Attachments

          Activity

            People

            • Assignee:
              couet Olivier Couet
              Reporter:
              7c1a9eb1ba422186dff9 zog@ssl.berkeley.edu
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Actual End: