You are here

Interface Freeze during operations

2 posts / 0 new
Last post
CmptrExpr
Offline
Last seen: 8 years 1 week ago
Joined: 2008-09-12 11:43
Interface Freeze during operations

I've noticed that during file operations (scan, copy, move, etc.) the interface freezes. This is not a good thing. A few coding changes will make the interface much more responsive to the user.

When I looked through the source code, I found the code which causes the interface to freeze. This bit of code is found after starting the thread (multiple instances) in script.cpp:

    thread->Wait();
    delete thread;


To fix the problem, remove the two lines and create a new event that is posted to the frame from the started thread when it completes. Events and messages from the thread should always post to the intended window (main or progress) so that the actual changes to the window run in the context of the frame thread rather than the sync thread. Sending across threads can cause problems when updating the window content (race conditions).

When the progress window processes the completion event, it can change the buttons accordingly.

Additional items to think about:

The user should not be able to close the progress window until the thread completes. The user should not be able to start a new thread until the old one completes. This may mean that you need to store the started thread's object in the progress object and check it for running/completion/exit status when the user clicks on anything in the progress window.

You could additionally make the progress window non-modal and store thread state in the mainframe object. This will allow configuration changes, navigation, etc. while the thread is running. The only thing not allowed is starting a new thread.

Doing all of the above will make the application much more responsive to the user and will hog fewer desktop resources.

Steve Lamerton
Steve Lamerton's picture
Offline
Last seen: 10 years 6 months ago
Developer
Joined: 2005-12-10 15:22
Thankyou

for looking into this, I shall aim to write some more detailed feedback later, but the propsals you have make look very good, I shall aim to implement them as soon as possible,

Log in or register to post comments