Re: [ROOT] Multithreaded GUI, TRootEmbeddedCanvas

From: Victor Perevoztchikov (perev@bnl.gov)
Date: Mon Aug 20 2001 - 15:52:30 MEST


Hi Thomas,

TCanvas::Update has defence from non thread safe X11. 

 void TCanvas::Update()
{
   if (gThreadXAR) {  //<========================= This is defence
      void *arr[2];
      arr[1] = this;
      if ((*gThreadXAR)("CUPD", 2, arr, NULL)) return;
   }
   if (!IsBatch()) FeedbackMode(kFALSE);      // Goto double buffer mode
   PaintModified();           // Repaint all modified pad's
   Flush();                   // Copy all pad pixmaps to the screen
   SetCursor(kCross);
}

But may be due to your own TApplication the gThreadXAR is zero.
Check it please.

Victor

Thomas Bretz wrote:
> 
> Hello,
> 
> I have some trouble with the following:
> 
> I have a class derived from TApplication. In its constructor I create a
> GUI (a class derived from TMainFrame, which creates two instances of a
> class derived from RootEmbeddedCanvas) and a thread. The thread calls
> GetCanvas()->Modified() and GetCanvas()->Update() for both embedded
> canvases after updating its contents in a loop.
> In most cases I get some X11 error about invalid Pixmaps. I guess it is
> because TApplication::Run() and the GUI-Update-Loop are running in
> different threads. How can I work around this? (Maybe I could use
> timers, but for me it is important to run the updating thread with less
> priority than the main thread).
> 
> Can somebody help me?
> 
> Thanks,
> Thomas.

-- 
Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch       
Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:58 MET