#! /bin/sh /usr/share/dpatch/dpatch-run ## 11_fix-desktop-freeze.dpatch by Adrien Cunin ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: Fix desktop freezing, upstream rev. 3605, LP: #497836. @DPATCH@ diff -urNad filezilla-3.3.1~/src/interface/asyncrequestqueue.cpp filezilla-3.3.1/src/interface/asyncrequestqueue.cpp --- filezilla-3.3.1~/src/interface/asyncrequestqueue.cpp 2010-01-02 15:42:28.000000000 +0100 +++ filezilla-3.3.1/src/interface/asyncrequestqueue.cpp 2010-03-10 23:13:09.283899923 +0100 @@ -14,6 +14,7 @@ BEGIN_EVENT_TABLE(CAsyncRequestQueue, wxEvtHandler) EVT_COMMAND(wxID_ANY, fzEVT_PROCESSASYNCREQUESTQUEUE, CAsyncRequestQueue::OnProcessQueue) +EVT_TIMER(wxID_ANY, CAsyncRequestQueue::OnTimer) END_EVENT_TABLE() CAsyncRequestQueue::CAsyncRequestQueue(CMainFrame *pMainFrame) @@ -22,6 +23,7 @@ m_pQueueView = 0; m_pVerifyCertDlg = new CVerifyCertDialog; m_inside_request = false; + m_timer.SetOwner(this); } CAsyncRequestQueue::~CAsyncRequestQueue() @@ -434,6 +436,14 @@ bool CAsyncRequestQueue::CheckWindowState() { + m_timer.Stop(); + wxMouseState mouseState = wxGetMouseState(); + if (mouseState.LeftDown() || mouseState.MiddleDown() || mouseState.RightDown()) + { + m_timer.Start(1000, true); + return false; + } + #ifndef __WXMAC__ if (m_pMainFrame->IsIconized()) { @@ -454,3 +464,9 @@ return true; } + +void CAsyncRequestQueue::OnTimer(wxTimerEvent& event) +{ + TriggerProcessing(); +} + diff -urNad filezilla-3.3.1~/src/interface/asyncrequestqueue.h filezilla-3.3.1/src/interface/asyncrequestqueue.h --- filezilla-3.3.1~/src/interface/asyncrequestqueue.h 2010-01-02 15:42:28.000000000 +0100 +++ filezilla-3.3.1/src/interface/asyncrequestqueue.h 2010-03-10 23:13:09.283899923 +0100 @@ -41,9 +41,12 @@ DECLARE_EVENT_TABLE(); void OnProcessQueue(wxCommandEvent &event); + void OnTimer(wxTimerEvent& event); // Reentrancy guard bool m_inside_request; + + wxTimer m_timer; }; #endif //__ASYNCREQUESTQUEUE_H__ diff -urNad filezilla-3.3.1~/src/interface/edithandler.cpp filezilla-3.3.1/src/interface/edithandler.cpp --- filezilla-3.3.1~/src/interface/edithandler.cpp 2010-01-02 15:42:28.000000000 +0100 +++ filezilla-3.3.1/src/interface/edithandler.cpp 2010-03-10 23:13:09.293867543 +0100 @@ -49,6 +49,7 @@ m_pQueue = 0; m_timer.SetOwner(this); + m_busyTimer.SetOwner(this); #ifdef __WXMSW__ m_lockfile_handle = INVALID_HANDLE_VALUE; @@ -188,6 +189,8 @@ { if (m_timer.IsRunning()) m_timer.Stop(); + if (m_busyTimer.IsRunning()) + m_busyTimer.Stop(); if (m_localDir != _T("")) { @@ -622,126 +625,90 @@ insideCheckForModifications = true; -checkmodifications_remote: - for (std::list::iterator iter = m_fileDataList[remote].begin(); iter != m_fileDataList[remote].end(); iter++) + for (int i = 0; i < 2; i++) { - if (iter->state != edit) - continue; - - wxFileName fn(iter->file); - if (!fn.FileExists()) - { - m_fileDataList[remote].erase(iter); - - // Evil goto. Imo the next C++ standard needs a comefrom keyword. - goto checkmodifications_remote; - } - - wxDateTime mtime; - +checkmodifications_loopbegin: + for (std::list::iterator iter = m_fileDataList[i].begin(); iter != m_fileDataList[i].end(); iter++) { - wxLogNull log; // If GetModificationTime fails wx spams error messages - mtime = fn.GetModificationTime(); - } - - if (!mtime.IsValid()) - continue; - - if (iter->modificationTime.IsValid() && iter->modificationTime == mtime) - continue; + if (iter->state != edit) + continue; - // File has changed, ask user what to do + wxFileName fn(iter->file); + if (!fn.FileExists()) + { + m_fileDataList[i].erase(iter); - wxTopLevelWindow* pTopWindow = (wxTopLevelWindow*)wxTheApp->GetTopWindow(); - if (pTopWindow && pTopWindow->IsIconized()) - { - pTopWindow->RequestUserAttention(wxUSER_ATTENTION_INFO); - insideCheckForModifications = false; - return; - } + // Evil goto. Imo the next C++ standard needs a comefrom keyword. + goto checkmodifications_loopbegin; + } - bool remove; - int res = DisplayChangeNotification(remote, iter, remove); - if (res == -1) - continue; + wxDateTime mtime; - if (res == wxID_YES) - { - UploadFile(remote, iter, remove); - goto checkmodifications_remote; - } - else if (remove) - { - if (!fn.FileExists() || wxRemoveFile(fn.GetFullPath())) { - m_fileDataList[remote].erase(iter); - goto checkmodifications_remote; + wxLogNull log; // If GetModificationTime fails wx spams error messages + mtime = fn.GetModificationTime(); } - iter->state = removing; - } - else if (!fn.FileExists()) - { - m_fileDataList[remote].erase(iter); - goto checkmodifications_remote; - } - else - iter->modificationTime = mtime; - } - -checkmodifications_local: - for (std::list::iterator iter = m_fileDataList[local].begin(); iter != m_fileDataList[local].end(); iter++) - { - if (iter->state != edit) - continue; - - wxFileName fn(iter->file); - if (!fn.FileExists()) - { - m_fileDataList[local].erase(iter); - - // Evil goto. Imo the next C++ standard needs a comefrom keyword. - goto checkmodifications_local; - } - - wxDateTime mtime; - - { - wxLogNull log; // If GetModificationTime fails wx spams error messages - mtime = fn.GetModificationTime(); - } + if (!mtime.IsValid()) + continue; - if (!mtime.IsValid()) - continue; + if (iter->modificationTime.IsValid() && iter->modificationTime == mtime) + continue; - if (iter->modificationTime.IsValid() && iter->modificationTime == mtime) - continue; + // File has changed, ask user what to do - // File has changed, ask user what to do + m_busyTimer.Stop(); + wxMouseState mouseState = wxGetMouseState(); + if (mouseState.LeftDown() || mouseState.MiddleDown() || mouseState.RightDown()) + { + m_busyTimer.Start(1000, true); + insideCheckForModifications = false; + return; + } - wxTopLevelWindow* pTopWindow = (wxTopLevelWindow*)wxTheApp->GetTopWindow(); - if (pTopWindow && pTopWindow->IsIconized()) - { - pTopWindow->RequestUserAttention(wxUSER_ATTENTION_INFO); - insideCheckForModifications = false; - return; - } + wxTopLevelWindow* pTopWindow = (wxTopLevelWindow*)wxTheApp->GetTopWindow(); + if (pTopWindow && pTopWindow->IsIconized()) + { + pTopWindow->RequestUserAttention(wxUSER_ATTENTION_INFO); + insideCheckForModifications = false; + return; + } - bool remove; - int res = DisplayChangeNotification(local, iter, remove); + bool remove; + int res = DisplayChangeNotification(CEditHandler::fileType(i), iter, remove); + if (res == -1) + continue; - if (res == wxID_YES) - UploadFile(local, iter, remove); - else if (remove) - m_fileDataList[local].erase(iter); - else if (!fn.FileExists()) - { - m_fileDataList[remote].erase(iter); - goto checkmodifications_remote; + if (res == wxID_YES) + { + UploadFile(CEditHandler::fileType(i), iter, remove); + goto checkmodifications_loopbegin; + } + else if (remove) + { + if (i == remote) + { + if (!fn.FileExists() || wxRemoveFile(fn.GetFullPath())) + { + m_fileDataList[i].erase(iter); + goto checkmodifications_loopbegin; + } + iter->state = removing; + } + else + { + m_fileDataList[i].erase(iter); + goto checkmodifications_loopbegin; + } + } + else if (!fn.FileExists()) + { + m_fileDataList[i].erase(iter); + goto checkmodifications_loopbegin; + } + else + iter->modificationTime = mtime; } - else - iter->modificationTime = mtime; - goto checkmodifications_local; } SetTimerState(); diff -urNad filezilla-3.3.1~/src/interface/edithandler.h filezilla-3.3.1/src/interface/edithandler.h --- filezilla-3.3.1~/src/interface/edithandler.h 2010-01-02 15:42:28.000000000 +0100 +++ filezilla-3.3.1/src/interface/edithandler.h 2010-03-10 23:13:09.283899923 +0100 @@ -118,6 +118,7 @@ CQueueView* m_pQueue; wxTimer m_timer; + wxTimer m_busyTimer; void RemoveTemporaryFiles(const wxString& temp);