ROOTGUI event handling

Hi,

I’m using an embedded canvas in a ROOT GUI application and want to switch the displayed content via buttons. This in itself is working fine, however, if I swap out the drawn content with something else while moving the mouse over the canvas I produce a seg-fault because the internal GUI workings try to query an already deleted object. How can I prevent “mouse entry signals” while I am changing things in an embedded canvas?

Hi,

You could try something like this: fEmbeddedCanvas->GetContainer()->RemoveInput(kPointerMotionMask);
Cheers, Bertrand.

Unfortunately that did not work, the stack trace is:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) thread apply all bt

Thread 9 (Thread 0x1b43 of process 60819):
#0 0x0000000000000000 in ?? ()
Backtrace stopped: Cannot access memory at address 0x0

Thread 8 (Thread 0x1a1b of process 60819):
#0 0x00007fff935be4de in mach_msg_trap () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00007fff935bd64f in mach_msg () from /usr/lib/system/libsystem_kernel.dylib
#2 0x00007fff8bc38eb4 in ?? () from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#3 0x0000000100000000 in ?? ()
#4 0xffffffff91de90fd in ?? ()
#5 0x00000001165cd094 in ?? ()
#6 0x0700010111d5a980 in ?? ()
#7 0x00000001165cd0a8 in ?? ()
#8 0x00006b0300000001 in ?? ()
#9 0x00000001165cd0a0 in ?? ()
#10 0x0000000000000001 in ?? ()
#11 0x00000001165cd0b0 in ?? ()
#12 0x0000000000006b03 in ?? ()
#13 0x0000000111d5e250 in ?? ()
#14 0x00000000ffffffff in ?? ()
#15 0x00000001165cdce0 in ?? ()
#16 0x00007fff8bc3837b in ?? () from /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
#17 0x0000000000000000 in ?? ()

Thread 7 (Thread 0x1903 of process 60819):
#0 0x00007fff935c394a in __workq_kernreturn () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00007fff971826c3 in _pthread_wqthread () from /usr/lib/system/libsystem_pthread.dylib
#2 0x00007fff9718040d in start_wqthread () from /usr/lib/system/libsystem_pthread.dylib
#3 0x0000000000000000 in ?? ()

Thread 4 (Thread 0x1603 of process 60819):
#0 0x00007fff935c394a in __workq_kernreturn () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00007fff971826c3 in _pthread_wqthread () from /usr/lib/system/libsystem_pthread.dylib
#2 0x00007fff9718040d in start_wqthread () from /usr/lib/system/libsystem_pthread.dylib
#3 0x0000000000000000 in ?? ()

Thread 3 (Thread 0x1503 of process 60819):
#0 0x00007fff935c394a in __workq_kernreturn () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00007fff971826c3 in _pthread_wqthread () from /usr/lib/system/libsystem_pthread.dylib
#2 0x00007fff9718040d in start_wqthread () from /usr/lib/system/libsystem_pthread.dylib
#3 0x0000000000000000 in ?? ()

Thread 2 (Thread 0x1327 of process 60819):
#0 0x00007fff935c4232 in kevent64 () from /usr/lib/system/libsystem_kernel.dylib
#1 0x00007fff95119d91 in ?? () from /usr/lib/system/libdispatch.dylib
#2 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x1203 of process 60819):
#0 0x0000000000000000 in ?? ()
#1 0x000000010084098d in TCanvas::EnterLeave(TPad*, TObject*) () from /Users/balzer/Software/root-6.02.05/lib/libGpad.so
#2 0x0000000100841133 in TCanvas::HandleInput(EEventType, int, int) () from /Users/balzer/Software/root-6.02.05/lib/libGpad.so
#3 0x0000000100578029 in TRootEmbeddedCanvas::HandleContainerMotion(Event_t*) () from /Users/balzer/Software/root-6.02.05/lib/libGui.so
#4 0x00000001004a6e46 in TGFrame::HandleEvent(Event_t*) () from /Users/balzer/Software/root-6.02.05/lib/libGui.so
#5 0x0000000100476d96 in TGClient::HandleEvent(Event_t*) () from /Users/balzer/Software/root-6.02.05/lib/libGui.so
#6 0x0000000100476c4a in TGClient::ProcessOneEvent() () from /Users/balzer/Software/root-6.02.05/lib/libGui.so
—Type to continue, or q to quit—
#7 0x000000010047585a in TGInputHandler::Notify() () from /Users/balzer/Software/root-6.02.05/lib/libGui.so
#8 0x0000000100225893 in TMacOSXSystem::DispatchOneEvent(bool) () from /Users/balzer/Software/root-6.02.05/lib/libCore.so
#9 0x000000010016cdaa in TSystem::InnerLoop() () from /Users/balzer/Software/root-6.02.05/lib/libCore.so
#10 0x000000010016cbfb in TSystem::Run() () from /Users/balzer/Software/root-6.02.05/lib/libCore.so
#11 0x0000000100114064 in TApplication::Run(bool) () from /Users/balzer/Software/root-6.02.05/lib/libCore.so
#12 0x0000000100006bb3 in main ()

So the TObject in EnterLeave is a pointer to an already deleted object and I can’t figure out how to get around that :frowning:

Could you post a minimal running example reproducing this problem?
And BTW, which version of ROOT? Which OS/compiler version?
EDIT: You could also try this:

fEmbeddedCanvas->GetContainer()->RemoveInput(kPointerMotionMask | kEnterWindowMask | kLeaveWindowMask);

Sorry for not being more detailed before. I’m using ROOT 6.02.05 on Mac OS X 10.10.3 self-compiled (default Mac OS X 10.10.3 clang version) using some brew components (fitsio, gsl, …):

brew install gsl
brew install cfitsio
brew install boost --with-icu4c --c++11
brew install doxygen --with-libclang --with-dot
brew install fftw
brew install jpeg
brew install libpng
brew install libtiff --c++11
brew install modules
brew install pkg-config
brew install python --with-brewed-tk
brew install protobuf --c++11 --with-python
brew install subversion --with-python --with-perl
brew install swig
brew install zeromq --with-pgm

ROOT was compiled like that:
wget root.cern.ch/download/root_v6.02 … rce.tar.gz
tar xzf root_v6.02.05.source.tar.gz
mkdir build
cd build/
mkdir ~/Software/root-6.02.05/
export CMAKE_PREFIX_PATH=/usr/local/
cmake …/root-6.02.05/ -DCMAKE_INSTALL_PREFIX=/Users/balzer/Software/root-6.02.05/ -DCMAKE_BUILD_TYPE=Release -Dall=ON
make -j5
make install

I needed to fix an include in net/netxng/src/TNetXNGFile.cxx (#include <XrdVersion.hh>) …
I’ll try to provide a minimal working example soon, I’m at a conference atm (Japan)… I’ll try the additional options you posted today

Hi,

OK, that might well be a Mac OS X issue, but I don’t have any Mac to actually try anything… Anyway, let me know if the additional options help, and if you can post a reproducer nevertheless (and enjoy Japan and CHEP)

Cheers, Bertrand.

So I tried it on a SL7 VM and there the same problem occurs. I’ll try to produce a minimal demonstrator :slight_smile:

I reorganised the drawing on the canvas a bit and now it seems to work just fine. Don’t know exactly what was the reason in the end but it seems to be gone now :slight_smile: