Problem with OpenGLComponent + ThreadWithProgressWindow



I am using a code like this for my program

class aClass : public OpenGLComponent,
                     public ThreadWithProgressWindow 
     aClass () : ThreadWithProgressWindow(...) {}
     ~aClass () {}   

     void doAlgorithm() 
            makeCurrentContextInactive ();

     void run() 
            while ()
                // ... some computation and rendering

I have used this class with new operator in my main window. and it exist from the first moment the main window starts. then I have a button in my window that if I press it it will call aClass->doAlgorithm();

The code is really more complicated than above. but everything works fine for the first time. the progress window appears . you know. everything is fine.

but the second time that I click the button, The Visual C++ 2005 triggers a breakpoint with break and continue

if I press continue , the code works fine again with no memory leaks or anything.

I don’t know where to look for the problem. I tried everything. the code just work fine but with a triggered breakpoint everytime.

does anybody know what is going on here or how I may get a debug message from JUCE to know what it is up to ?


well, why haven’t you had a look to see where it’s breaking? [i.e. don’t press continue, look at where in the program it has broken!]


first thing you have to do is to learn how to use your debugger to know where this comes from. google is your friend.
Also try to make your code more simple and comment out large parts of it to know where is the culprit.


well , I have checked it . the program beaks over the line runThread() when it wants to run it for the second time. I have checked every single variables and everything seems normal to me. but when I want to investigate more over the code , It just shows some disassemble code which I can’t understand. but there is always a red line and shows the value of the main window and it’s component content.

by the way , by continuing the program, no problem or leaks occurs and the program just work fine for the second , third and … time except for the breakpoint which triggers every time.