Hi,<div><br></div><div>could you (or anybody), eventually, have a look at the test that I shared?</div><div><br></div><div>As a workaround I disabled the Next button until the computation finishes (between the onExit and the onExitComplete signal), but it treats only one symptom.</div>

<div><br></div><div>Now I ran into the problem again, and I do not know what to do with this. Step2 relies on some data that Step1 creates in the onExitComplete function. However, because of the bug, the data is not ready. The events happen in this order:</div>

<div><br></div><div>Step1 onExit</div><div>Step2 onEntry</div><div>Step2 createUserInterface</div><div>Step1 onExitComplete<br><br>In my opinion, the step1 onExitComplete should be invoked before step2 onEntry.</div><div>

<br></div><div>Even, it would not be bad if the user interface was ready before the onEntry signal, but it is not so important.</div><div><br></div><div>Thanks,</div><div>Miklos</div><div><br><div class="gmail_quote">On Tue, Oct 25, 2011 at 3:11 PM, Miklos Espak <span dir="ltr"><<a href="mailto:espakm@gmail.com">espakm@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<div><br></div><div>I added a new test. You can run it by </div><div><br></div><div>$ ./CTKWidgetsCppTests ctkExampleUseOfWorkflowWidgetUsingThreads -I<br>

<br>in the project bin directory.</div><div><br></div><div>The onExit function of the steps start a thread that waits for 5 sec ("calculation"). The onExitComplete signal is sent when the thread finishes.</div>

<div><br></div><div>If you press the Next button, the "calculation" starts and after 5 sec you get to the next page. That is fine. However, if you press Next within this period, the thread of the second step will start, although the first step has not finished. (It has not sent the onExitComplete signal.)</div>


<div><br></div><div>You can checkout the test via GitHub:</div><div><br></div><div><a href="https://github.com/commontk/CTK/issues/61" target="_blank">https://github.com/commontk/CTK/issues/61</a></div><div><br></div><div>

Thanks for dealing with this issue!</div>
<div><br></div><div>Best,</div><div>Miklos</div><div><div></div><div class="h5"><div><br><div class="gmail_quote">On Mon, Oct 24, 2011 at 11:47 PM, Miklos Espak <span dir="ltr"><<a href="mailto:espakm@gmail.com" target="_blank">espakm@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div class="gmail_quote"><div>By running the step in a different thread, what do you mean exactly ? <br>

</div></div></blockquote><div><br></div></div><div>Sorry, I was not clear. I run some calculations (ITK filters) in the workflow steps, and I start them in a new thread. The workflow step listens to the "finished" and "terminated" signal of the thread and it signals "onExitCompleted" after the thread is finished.</div>


<div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div>As a side note: "Although <a href="http://doc.qt.nokia.com/stable/qobject.html" target="_blank">QObject</a> is reentrant, the GUI classes, notably <a href="http://doc.qt.nokia.com/stable/qwidget.html" target="_blank">QWidget</a> and all its subclasses, are not reentrant. They can only be used from the main thread."<br>






See <a href="http://doc.qt.nokia.com/stable/threads-qobject.html" target="_blank">http://doc.qt.nokia.com/stable/threads-qobject.html</a></div></div></blockquote><div><br></div></div><div>Yes, I had some troubles because of this, but I solved them. I refactored every GUI access from the function that runs the calculation. E.g. the thread that runs the calculation notifies the GUI thread through signals about the progress of the internal ITK filters. In this way the thread does not need to access the progress bar.</div>


<div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204, 204, 204);padding-left:1ex">



<div>Would it be possible for you to share some code ? May a topic on your CTK fork ?</div></blockquote></div></div></blockquote><div><br></div></div><div>Yes, I will upload a sample app tomorrow.</div><div><br></div><div>


Thanks,</div>
<div>Miklos</div><div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>