[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Proposal: Adding a class to automatically manage the wait cursor and OK button enabled status

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Fri, 31 May 2013 17:42:54 +0200

On 31.05.2013 05:09, Friedrich Brunzema wrote:
> I have committed the class, and will now remove the duplication.
> Stefan, could you do a review? I have some comments on possible code
> removals, but don't know if they are needed for some other reason. I
> know some of the code is process re-entrant, don't know how it
> behaves in that case.
>
> If this class gets used in a nested way, I think the hourglass cursor
> will still stay (as its reference counted), after the inner object
> goes out of scope - it then also re-enables OK. As the out object
> goes out of scope, the hourglass go away, and the Ok which is already
> enabled gets re-enabled, which is fine.

There's a problem now with this implementation:
You're enabling the OK button when this helper class goes out of scope.
That seems ok on first sight, but it doesn't work correctly when the
command is executed on another thread.

Right now, you're creating the helper class before the commands are
executed. It goes out of scope and reenables the OK button as soon as
the command is done. But the commands that start another thread will be
'done' as soon as the thread is created, not when the actual command is
finished (it runs on a different thread and takes much much longer to
finish). So while the real command is still running, the OK button is
already enabled again.

You've noticed that there's something wrong already: you've marked those
places with the comment 'necessary? (running in a separate thread)'.
Yes: that's necessary. But in these situations you must create the
helper class on that thread or not use it at all. The way it is now is
wrong.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest interface to (Sub)version control
    /_/   \_\     http://tortoisesvn.net
------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=757&dsMessageId=3056808
To unsubscribe from this discussion, e-mail: [dev-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2013-06-01 03:08:37 CEST

This is an archived mail posted to the TortoiseSVN Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.