[wxVTK] BadWindow (invalid Window parameter) - Race Condition?
                
                Brought to you by:
                
                    malat
                    
                
            
            
        
        
        
    | 
      
      
      From: Alexander N. <ale...@gm...> - 2006-06-08 18:21:35
      
     | 
| Dear All,
I would like to report what appears to be a race condition and a work 
around, just in case I am not alone. I apologize if this has been 
covered previously.
I compiled the CVS version wxVTK on Fedora 4 and linked it dynamically 
to the latest versions of VTK and wxGTK. When I executed any of the 
sample programs, I would get the following X error and the program would 
exit normally:
The program 'Sample' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
   (Details: serial 7 error_code 3 request_code 2 minor_code 0)
   (Note to programmers: normally, X errors are reported asynchronously;
    that is, you will receive the error a while after causing it.
    To debug your program, run it with the --sync command line
    option to change this behavior. You can then get a meaningful
    backtrace from your debugger if you break on the gdk_x_error() 
function.)
However, everything worked just fine as soon as I used the "--sync" 
option. So I couldn't really get a useful backtrace from gdb. I did a 
little bit of debugging and found that the OnPaint method was fired 
prematurely (Skipping the first call and everything would work fine with 
or without the --sync switch). I did a bit of web searching and 
eventually solved the problem by sticking the following line right 
before the Render() call in the OnPaint() method:
   this->SetCurrent();
Does this lead to other side effects? At least all Sample programs are 
now working normally for me.
Alex
 |