iucar / rpms / root

Forked from rpms/root 3 years ago
Clone
Blob Blame History Raw
From 961e9457ce3a9f6641819ceab61ce55b147d2fe5 Mon Sep 17 00:00:00 2001
From: Bertrand Bellenot <bertrand.bellenot@cern.ch>
Date: Fri, 21 Sep 2018 11:10:07 +0200
Subject: [PATCH] Fix Jira issue #ROOT-9640 Segmentation violation after
 starting TBrowser b

Only connect/disconnect TGHtmlBrowser signals when it is present
---
 gui/gui/src/TGFileBrowser.cxx | 8 +++++---
 gui/gui/src/TRootBrowser.cxx  | 4 ++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gui/gui/src/TGFileBrowser.cxx b/gui/gui/src/TGFileBrowser.cxx
index 3f6ce23b60..17b13bacaf 100644
--- a/gui/gui/src/TGFileBrowser.cxx
+++ b/gui/gui/src/TGFileBrowser.cxx
@@ -232,8 +232,9 @@ void TGFileBrowser::CreateBrowser()
 
    fDblClick = kFALSE;
 
-   TQObject::Connect("TGHtmlBrowser", "Clicked(char*)",
-                     "TGFileBrowser", this, "Selected(char*)");
+   if (TClass::GetClass("TGHtmlBrowser"))
+      TQObject::Connect("TGHtmlBrowser", "Clicked(char*)",
+                        "TGFileBrowser", this, "Selected(char*)");
 
    TQObject::Connect("TPad", "Modified()",
                      "TGFileBrowser", this, "PadModified()");
@@ -249,7 +250,8 @@ void TGFileBrowser::CreateBrowser()
 
 TGFileBrowser::~TGFileBrowser()
 {
-   TQObject::Disconnect("TGHtmlBrowser", "Clicked(char*)");
+   if (TClass::GetClass("TGHtmlBrowser"))
+      TQObject::Disconnect("TGHtmlBrowser", "Clicked(char*)");
    TQObject::Disconnect("TPad", "Modified()");
 
    delete fContextMenu;
diff --git a/gui/gui/src/TRootBrowser.cxx b/gui/gui/src/TRootBrowser.cxx
index 8105c29d09..56c39585bd 100644
--- a/gui/gui/src/TRootBrowser.cxx
+++ b/gui/gui/src/TRootBrowser.cxx
@@ -54,6 +54,7 @@
 #include "TSystem.h"
 #include "TApplication.h"
 #include "TBrowser.h"
+#include "TClass.h"
 #include "TGClient.h"
 #include "TGFrame.h"
 #include "TGTab.h"
@@ -213,6 +214,9 @@ void TRootBrowser::CreateBrowser(const char *name)
    fPreMenuFrame->AddFrame(fMenuBar, fLH2);
    fTopMenuFrame->AddFrame(fPreMenuFrame, fLH0);
 
+   if (!TClass::GetClass("TGHtmlBrowser"))
+      fMenuFile->DisableEntry(kNewHtml);
+
    fMenuFrame = new TGHorizontalFrame(fTopMenuFrame, 100, 20, kRaisedFrame);
    fTopMenuFrame->AddFrame(fMenuFrame, fLH5);
 
-- 
2.17.2