Qt Root Fatal error: requested non-existing drawable 0

My setup: ROOT 5.34/37 (heads/v5-34-00-patches@v5-34-36-17-gceb4d24, May 07 2016, 00:27:01 on macosx64)
-tried with ROOT6
-tried changing to Qt5.7
no improvement.

I made a Qt app, which uses Root.
On LinuxMint and SLC5 it compiles and runs as expected.
I try on Mac. Compile seems to finish ok.
When running the application, I get this:

Application Output from Qt

Starting /Users/ak/workspace/build-vmm-mon-Desktop_Qt_5_6_0_clang_64bit-Debug/vmm-mon.app/Contents/MacOS/vmm-mon...
2016-11-28 17:49:29.233 vmm-mon[40178:2018365] Fatal error: requested non-existing drawable 0
2016-11-28 17:49:29.233 vmm-mon[40178:2018365] This drawable not found among allocated/deleted drawables

 *** Break *** segmentation violation
 Generating stack trace...
 0x000000010b115949 in TCanvas::TCanvas(char const*, int, int, int) (in libGpad.so) + 409
 0x00000001093f1daf in QRootCanvas::QRootCanvas(QWidget*) (in vmm-mon) (canvas.cxx:37)
 0x00000001093f1e1d in QRootCanvas::QRootCanvas(QWidget*) (in vmm-mon) (canvas.cxx:39)
 0x00000001093f2489 in QMainCanvas::QMainCanvas(QWidget*) (in vmm-mon) (canvas.cxx:140)
 0x00000001093f264d in QMainCanvas::QMainCanvas(QWidget*) (in vmm-mon) (canvas.cxx:153)
 0x00000001093e53fc in MainWindow::createCanvas() (in vmm-mon) (mainwindow.cpp:51)
 0x00000001093e5122 in MainWindow::MainWindow(QWidget*) (in vmm-mon) (mainwindow.cpp:15)
 0x00000001093e55fd in MainWindow::MainWindow(QWidget*) (in vmm-mon) (mainwindow.cpp:16)
 0x00000001093e3dc4 in main (in vmm-mon) (main.cpp:13)
 0x00000001093e3d14 in start (in vmm-mon) + 52
/Users/ak/workspace/build-vmm-mon-Desktop_Qt_5_6_0_clang_64bit-Debug/vmm-mon.app/Contents/MacOS/vmm-mon exited with code 1[/code]
On my code, it crashes when this runs:
[code]    fCanvas = new TCanvas("Root Canvas", width(), height(), wid);

googled it for a while without success.

You can mix Qt and Root on Linux to some degree because drawables both frameworks are using are the same drawables known by X11 server. On macOS Qt is using the Apple’s native framework - Cocoa. So what you have from widget.winId() - 64-bit value, which is a pointer to a native NSView object. And ROOT is still using drawables - some integer indices, which have no meaning outside ROOT - they are keys in some internal data structure ROOTCocoa is using. You can try to run XQuartz but it wont help - XQuartz, like ROOT, has it’s own drawables (integer identifiers), which are not pointers; and pointers from Qt/Cocoa have no meaning for XQuartz == invalid drawable (the same way they are useless in ROOT).

thank you very much for your input tpochep

As I understand the only potential solution is xQuartz, although you don’t think this will work.

[quote=“meleneemil”]thank you very much for your input tpochep

As I understand the only potential solution is xQuartz, although you don’t think this will work.[/quote]

Like ROOT, XQuartz does not accept NSView * pointers as drawables since they are not drawables it is aware of.

Let me try another approach.

Is there an example of QtRoot in Mac? One that can show TCanvas?

thank you!