Skip to content

Commit

Permalink
Prevent autoloading of libGQt when calling gVirtualX->InheritsFrom("T…
Browse files Browse the repository at this point in the history
…GQt")

This fixes a potential crash when embedding a TCanvas in a Qt5 application with ROOT built with Qt4 for example, as reported on the forum: https://root-forum.cern.ch/t/dlopen-error-in-qt-application-when-saving-canvas-as-png/27297
  • Loading branch information
bellenot committed Dec 20, 2017
1 parent 92c89f1 commit 73a488b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion graf2d/gpad/src/TPad.cxx
Expand Up @@ -4839,7 +4839,7 @@ void TPad::Print(const char *filenam, Option_t *option)
gPad->GetCanvas()->SetHighLightColor(-1);
gPad->Modified();
gPad->Update();
if (gVirtualX->InheritsFrom("TGQt")) {
if (TClass::GetClass("TGQt", kFALSE) && gVirtualX->InheritsFrom("TGQt")) {
wid = (this == GetCanvas()) ? GetCanvas()->GetCanvasID() : GetPixmapID();
gVirtualX->WritePixmap(wid,UtoPixel(1.),VtoPixel(0.),(char *)psname.Data());
} else {
Expand Down

0 comments on commit 73a488b

Please sign in to comment.