Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileManager.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileManager.h	(revision 71644)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileManager.h	(revision 71645)
@@ -50,5 +50,5 @@
 
 /** QWidget extension
-  * providing GUI with guest session information and control tab in session-information window. */
+ *  providing GUI with guest session information and control tab in session-information window. */
 class UIGuestControlFileManager : public QIWithRetranslateUI<QWidget>
 {
@@ -103,5 +103,4 @@
     CGuest              m_comGuest;
     CGuestSession       m_comGuestSession;
-
     QVBoxLayout        *m_pMainLayout;
     QSplitter          *m_pVerticalSplitter;
@@ -113,8 +112,10 @@
     QHBoxLayout        *m_pFileTableContainerLayout;
     QITabWidget        *m_pTabWidget;
+
     UIFileOperationsList       *m_pFileOperationsList;
-    UIGuestControlConsole    *m_pConsole;
-    UIGuestControlInterface  *m_pControlInterface;
-
+    UIGuestControlConsole      *m_pConsole;
+    UIGuestControlInterface    *m_pControlInterface;
+    /* m_pSessionCreateWidget is a QWidget extension enabling user to start/stop
+     * a Guest Control session. */
     UIGuestSessionCreateWidget *m_pSessionCreateWidget;
     UIGuestFileTable           *m_pGuestFileTable;
@@ -128,3 +129,2 @@
 
 #endif /* !___UIGuestControlFileManager_h___ */
-
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.cpp	(revision 71644)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.cpp	(revision 71645)
@@ -143,5 +143,5 @@
     :QThread(parent)
     , m_pathList(pathList)
-    , m_bContinueRunning(true)
+    , m_fOkToContinue(true)
 {
 }
@@ -156,6 +156,11 @@
 {
     m_mutex.lock();
-    m_bContinueRunning = false;
+    m_fOkToContinue = false;
     m_mutex.unlock();
+}
+
+bool UIDirectoryDiskUsageComputer::isOkToContinue() const
+{
+    return m_fOkToContinue;
 }
 
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.h	(revision 71644)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestControlFileTable.h	(revision 71645)
@@ -58,4 +58,5 @@
 };
 
+/** A simple struck to store some statictics for a directory. Mainly used by  UIDirectoryDiskUsageComputer instances. */
 class UIDirectoryStatistics
 {
@@ -72,6 +73,6 @@
 
 /** Examines the paths in @p strStartPath and collects some staticstics from them recursively (in case directories)
-    Runs on a worker thread to avoid GUI freezes. UIGuestFileTable and UIHostFileTable uses specialized children
-    of this class since the call made on file objects are different */
+ *  Runs on a worker thread to avoid GUI freezes. UIGuestFileTable and UIHostFileTable uses specialized children
+ *  of this class since the calls made on file objects are different. */
 class UIDirectoryDiskUsageComputer : public QThread
 {
@@ -85,16 +86,23 @@
 
     UIDirectoryDiskUsageComputer(QObject *parent, QStringList strStartPath);
+    /** Sets the m_fOkToContinue to false. This results an early termination
+      * of the  directoryStatisticsRecursive member function. */
     void stopRecursion();
 
 protected:
 
-    /** Read the directory with the path @p path recursively and collect #of objects and
-        total size */
+    /** Read the directory with the path @p path recursively and collect #of objects and  total size */
     virtual void directoryStatisticsRecursive(const QString &path, UIDirectoryStatistics &statistics) = 0;
-    void                  run();
+    virtual void           run() /* override */;
+    /** Returns the m_fOkToContinue flag */
+    bool                  isOkToContinue() const;
+    /** Stores a list of paths whose statistics are accumulated, can be file, directory etc: */
     QStringList           m_pathList;
     UIDirectoryStatistics m_resultStatistics;
-    bool                  m_bContinueRunning;
     QMutex                m_mutex;
+
+private:
+
+    bool     m_fOkToContinue;
 };
 
@@ -148,6 +156,6 @@
 
     /** @p data contains values to be shown in table view's colums. data[0] is assumed to be
-        the name of the file object which is the file name including extension or name of the
-        directory */
+     *  the name of the file object which is the file name including extension or name of the
+     *  directory */
     explicit UIFileTableItem(const QList<QVariant> &data,
                              UIFileTableItem *parentItem, FileObjectType type);
@@ -214,7 +222,7 @@
 
 /** This class serves a base class for file table. Currently a guest version
-    and a host version are derived from this base. Each of these children
-    populates the UIGuestControlFileModel by scanning the file system
-    differently. The file structre kept in this class as a tree. */
+ *  and a host version are derived from this base. Each of these children
+ *  populates the UIGuestControlFileModel by scanning the file system
+ *  differently. The file structre kept in this class as a tree. */
 class UIGuestControlFileTable : public QIWithRetranslateUI<QWidget>
 {
@@ -250,23 +258,22 @@
     void insertItemsToTree(QMap<QString,UIFileTableItem*> &map, UIFileTableItem *parent,
                            bool isDirectoryMap, bool isStartDir);
-    virtual void readDirectory(const QString& strPath, UIFileTableItem *parent, bool isStartDir = false) = 0;
-    virtual void deleteByItem(UIFileTableItem *item) = 0;
-    virtual void goToHomeDirectory() = 0;
-    virtual bool renameItem(UIFileTableItem *item, QString newBaseName) = 0;
-    virtual bool createDirectory(const QString &path, const QString &directoryName) = 0;
-    virtual QString fsObjectPropertyString() = 0;
-    virtual void  showProperties() = 0;
-    static QString fileTypeString(FileObjectType type);
+    virtual void     readDirectory(const QString& strPath, UIFileTableItem *parent, bool isStartDir = false) = 0;
+    virtual void     deleteByItem(UIFileTableItem *item) = 0;
+    virtual void     goToHomeDirectory() = 0;
+    virtual bool     renameItem(UIFileTableItem *item, QString newBaseName) = 0;
+    virtual bool     createDirectory(const QString &path, const QString &directoryName) = 0;
+    virtual QString  fsObjectPropertyString() = 0;
+    virtual void     showProperties() = 0;
+    static QString   fileTypeString(FileObjectType type);
     void             goIntoDirectory(const QModelIndex &itemIndex);
-    /** Follow the path trail, open directories as we go and descend */
+    /** Follows the path trail, opens directories as it descends */
     void             goIntoDirectory(const QList<QString> &pathTrail);
-    /** Go into directory pointed by the @p item */
+    /** Goes into directory pointed by the @p item */
     void             goIntoDirectory(UIFileTableItem *item);
     UIFileTableItem* indexData(const QModelIndex &index) const;
-    void keyPressEvent(QKeyEvent * pEvent);
-    CGuestFsObjInfo guestFsObjectInfo(const QString& path, CGuestSession &comGuestSession) const;
+    void             keyPressEvent(QKeyEvent * pEvent);
+    CGuestFsObjInfo  guestFsObjectInfo(const QString& path, CGuestSession &comGuestSession) const;
 
     UIFileTableItem         *m_pRootItem;
-
     UIGuestControlFileView  *m_pView;
     UIGuestControlFileModel *m_pModel;
@@ -302,5 +309,5 @@
     void             prepareActions();
     void             deleteByIndex(const QModelIndex &itemIndex);
-    /** Return the UIFileTableItem for path / which is a direct (and single) child of m_pRootItem */
+    /** Returns the UIFileTableItem for path / which is a direct (and single) child of m_pRootItem */
     UIFileTableItem *getStartDirectoryItem();
     /** Shows a modal dialog with a line edit for user to enter a new directory name and return the entered string*/
@@ -321,5 +328,5 @@
     QVector<QAction*> m_selectionDependentActions;
     /** The absolue path list of the file objects which user has chosen to cut/copy. this
-        list will be cleaned after a paste operation or overwritten by a subsequent cut/copy */
+      * list will be cleaned after a paste operation or overwritten by a subsequent cut/copy */
     QStringList       m_copyCutBuffer;
     friend class UIGuestControlFileModel;
@@ -327,3 +334,2 @@
 
 #endif /* !___UIGuestControlFileTable_h___ */
-
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.cpp	(revision 71644)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.cpp	(revision 71645)
@@ -54,4 +54,5 @@
 protected:
 
+    virtual void run() /* override */;
     virtual void directoryStatisticsRecursive(const QString &path, UIDirectoryStatistics &statistics) /* override */;
 
@@ -72,10 +73,27 @@
 }
 
+void UIGuestDirectoryDiskUsageComputer::run()
+{
+    /* Initialize COM: */
+    COMBase::InitializeCOM(false);
+    UIDirectoryDiskUsageComputer::run();
+    /* Cleanup COM: */
+    COMBase::CleanupCOM();
+}
+
 void UIGuestDirectoryDiskUsageComputer::directoryStatisticsRecursive(const QString &path, UIDirectoryStatistics &statistics)
 {
     if (m_comGuestSession.isNull())
         return;
-    if (!m_bContinueRunning)
-        return;
+    /* Prevent modification of the continue flag while reading: */
+    m_mutex.lock();
+    /* Check if m_fOkToContinue is set to false. if so just end recursion: */
+    if (!isOkToContinue())
+    {
+        m_mutex.unlock();
+        return;
+    }
+    m_mutex.unlock();
+
     CGuestFsObjInfo fileInfo = m_comGuestSession.FsObjQueryInfo(path, true);
 
@@ -461,5 +479,6 @@
 
     /** @todo I have decided to look into this afterwards when API is more mature, for
-        currently this stuff runs into an assert in Main: */
+        currently this stuff runs into an assert in Main. this may be because that I will have to init deinit
+        COM. see UIThreadWorker: */
     /* if the selection include a directory or it is a multiple selection the create a worker thread
        to compute total size of the selection (recusively) */
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.h
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.h	(revision 71644)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIGuestFileTable.h	(revision 71645)
@@ -26,6 +26,6 @@
 #include "UIGuestControlFileTable.h"
 
-/** This class scans the guest file system by using the VBox API
-    and populates the UIGuestControlFileModel*/
+/** This class scans the guest file system by using the VBox Guest Control API
+ *  and populates the UIGuestControlFileModel*/
 class UIGuestFileTable : public UIGuestControlFileTable
 {
@@ -63,3 +63,2 @@
 
 #endif /* !___UIGuestControlFileTable_h___ */
-
Index: /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIHostFileTable.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIHostFileTable.cpp	(revision 71644)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/runtime/guestctrl/UIHostFileTable.cpp	(revision 71645)
@@ -62,7 +62,14 @@
 void UIHostDirectoryDiskUsageComputer::directoryStatisticsRecursive(const QString &path, UIDirectoryStatistics &statistics)
 {
-
-    if (!m_bContinueRunning)
-        return;
+    /* Prevent modification of the continue flag while reading: */
+    m_mutex.lock();
+    /* Check if m_fOkToContinue is set to false. if so just end recursion: */
+    if (!isOkToContinue())
+    {
+        m_mutex.unlock();
+        return;
+    }
+    m_mutex.unlock();
+
     QFileInfo fileInfo(path);
     if (!fileInfo.exists())
