4141#include " TSystem.h"
4242#include " TGCocoa.h"
4343#include " TROOT.h"
44+ #include " TGTextView.h"
45+ #include " TGView.h"
46+ #include " TGCanvas.h"
4447
4548
4649namespace ROOT {
@@ -896,7 +899,10 @@ bool ViewIsTextView(unsigned viewID)
896899 const TGWindow * const window = gClient ->GetWindowById (viewID);
897900 if (!window)
898901 return false ;
899- return window->InheritsFrom (" TGTextView" );
902+ // This code used to use TObject::InheritsFrom, however since this is
903+ // run under the AppKit, we can not call core/meta functions, otherwise
904+ // we will run into deadlocks.
905+ return dynamic_cast <const TGTextView*>(window);
900906}
901907
902908// ______________________________________________________________________________
@@ -916,7 +922,10 @@ bool ViewIsTextViewFrame(NSView<X11Window> *view, bool checkParent)
916922 if (!window)
917923 return false ;
918924
919- if (!window->InheritsFrom (" TGViewFrame" ))
925+ // This code used to use TObject::InheritsFrom, however since this is
926+ // run under the AppKit, we can not call core/meta functions, otherwise
927+ // we will run into deadlocks.
928+ if (!dynamic_cast <const TGViewFrame*>(window))
920929 return false ;
921930
922931 if (!checkParent)
@@ -934,7 +943,10 @@ bool ViewIsHtmlView(unsigned viewID)
934943 const TGWindow * const window = gClient ->GetWindowById (viewID);
935944 if (!window)
936945 return false ;
937- return window->InheritsFrom (" TGHtml" );
946+ // This code used to use TObject::InheritsFrom, however since this is
947+ // run under the AppKit, we can not call core/meta functions, otherwise
948+ // we will run into deadlocks.
949+ return window->TestBit (TGWindow::kIsHtmlView );
938950}
939951
940952// ______________________________________________________________________________
@@ -955,7 +967,10 @@ bool ViewIsHtmlViewFrame(NSView<X11Window> *view, bool checkParent)
955967 if (!window)
956968 return false ;
957969
958- if (!window->InheritsFrom (" TGViewFrame" ))
970+ // This code used to use TObject::InheritsFrom, however since this is
971+ // run under the AppKit, we can not call core/meta functions, otherwise
972+ // we will run into deadlocks.
973+ if (!dynamic_cast <const TGViewFrame*>(window))
959974 return false ;
960975
961976 if (!checkParent)
@@ -2705,7 +2720,10 @@ - (void) drawRect : (NSRect) dirtyRect
27052720 if (self.fQuartzWindow .fShapeCombineMask )
27062721 X11::ClipToShapeMask (self, fContext );
27072722
2708- if (window->InheritsFrom (" TGContainer" ))// It always has an ExposureMask.
2723+ // This code used to use TObject::InheritsFrom, however since this is
2724+ // run under the AppKit, we can not call core/meta functions, otherwise
2725+ // we will run into deadlocks.
2726+ if (dynamic_cast <const TGContainer*>(window))// It always has an ExposureMask.
27092727 vx->GetEventTranslator ()->GenerateExposeEvent (self, [self visibleRect ]);
27102728
27112729 if (fEventMask & kExposureMask ) {
0 commit comments