 <p>I tried to understand your code and failed... However I believe that I can recommend you to create special flag, (e.g. <code>buttonClicked</code>). The value of this variable will be <code>false</code>.</p> <p>When user clicks button the flow should arrive to code like this:</p> <pre><code>if (buttonClicked) { return; } buttonClicked = true; // do other stuff hrere </code></pre> <p>Please do not forget to synchronize this piece of code. Otherwise it could be executed simultaneously if user clicks fast enough.</p>