mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-26 13:26:16 +08:00
GP-1200 - Fixed UI live lock when connecting to remote project
This commit is contained in:
+3
-42
@@ -55,7 +55,7 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
|
||||
/**
|
||||
* Add a listener to this list.
|
||||
* @param listener
|
||||
* @param listener the listener
|
||||
*/
|
||||
public synchronized void add(FileSystemListener listener) {
|
||||
listenerList.add(listener);
|
||||
@@ -68,7 +68,7 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
|
||||
/**
|
||||
* Remove a listener from this list.
|
||||
* @param listener
|
||||
* @param listener the listener
|
||||
*/
|
||||
public void remove(FileSystemListener listener) {
|
||||
listenerList.remove(listener);
|
||||
@@ -81,10 +81,6 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
listenerList.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards itemMoved callback to all listeners within this list.
|
||||
* @see ghidra.framework.store.FileSystemListener#itemMoved(String, String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public void itemMoved(String parentPath, String name, String newParentPath, String newName) {
|
||||
if (enableAsynchronousDispatching) {
|
||||
@@ -97,10 +93,6 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards itemRenamed callback to all listeners within this list.
|
||||
* @see ghidra.framework.store.FileSystemListener#itemRenamed(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public void itemRenamed(String parentPath, String itemName, String newName) {
|
||||
if (enableAsynchronousDispatching) {
|
||||
@@ -113,10 +105,6 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards itemDeleted callback to all listeners within this list.
|
||||
* @see ghidra.framework.store.FileSystemListener#itemDeleted(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void itemDeleted(String parentPath, String itemName) {
|
||||
if (enableAsynchronousDispatching) {
|
||||
@@ -129,10 +117,6 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards folderRenamed callback to all listeners within this list.
|
||||
* @see ghidra.framework.store.FileSystemListener#folderRenamed(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public void folderRenamed(String parentPath, String folderName, String newFolderName) {
|
||||
if (enableAsynchronousDispatching) {
|
||||
@@ -145,10 +129,6 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards folderMoved callback to all listeners within this list.
|
||||
* @see ghidra.framework.store.FileSystemListener#folderMoved(String, String, String)
|
||||
*/
|
||||
@Override
|
||||
public void folderMoved(String parentPath, String folderName, String newParentPath) {
|
||||
if (enableAsynchronousDispatching) {
|
||||
@@ -161,10 +141,6 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards folderDeleted callback to all listeners within this list.
|
||||
* @see ghidra.framework.store.FileSystemListener#folderDeleted(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void folderDeleted(String parentPath, String folderName) {
|
||||
if (enableAsynchronousDispatching) {
|
||||
@@ -177,10 +153,6 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards itemCreated callback to all listeners within this list.
|
||||
* @see ghidra.framework.store.FileSystemListener#itemCreated(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void itemCreated(String parentPath, String itemName) {
|
||||
if (enableAsynchronousDispatching) {
|
||||
@@ -193,10 +165,6 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards folderCreated callback to all listeners within this list.
|
||||
* @see ghidra.framework.store.FileSystemListener#folderCreated(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void folderCreated(String parentPath, String folderName) {
|
||||
if (enableAsynchronousDispatching) {
|
||||
@@ -209,10 +177,6 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards itemChanged callback to all listeners within this list.
|
||||
* @see ghidra.framework.store.FileSystemListener#itemChanged(String, String)
|
||||
*/
|
||||
@Override
|
||||
public void itemChanged(String parentPath, String itemName) {
|
||||
if (enableAsynchronousDispatching) {
|
||||
@@ -225,10 +189,6 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards syncronize callback to all listeners within this list.
|
||||
* @see ghidra.framework.store.FileSystemListener#syncronize()
|
||||
*/
|
||||
@Override
|
||||
public void syncronize() {
|
||||
if (enableAsynchronousDispatching) {
|
||||
@@ -303,6 +263,7 @@ public class FileSystemListenerList implements FileSystemListener {
|
||||
}
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
// not sure why we are ignoring this
|
||||
}
|
||||
finally {
|
||||
isEventProcessingThreadWaiting = false;
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package ghidra.framework.store;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* This class is essentially a global flag used to track the long running file system synchronizing
|
||||
* operation. This class is a workaround to avoid rewriting the complicated file system locking.
|
||||
*/
|
||||
public class FileSystemSynchronizer {
|
||||
|
||||
private static AtomicBoolean isSynchronizing = new AtomicBoolean();
|
||||
|
||||
/**
|
||||
* Sets whether the synchronizing operation is running.
|
||||
* @param b true if synchronizing
|
||||
*/
|
||||
public static void setSynchronizing(boolean b) {
|
||||
isSynchronizing.set(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true the underlying file system is going through a long-running synchronization
|
||||
* operation while holding the {@code filesystem} lock. Calling this method allows clients
|
||||
* in the Swing thread to avoid calling methods that require a file system lock, which would
|
||||
* cause the UI to lock during the synchronizing operation.
|
||||
*
|
||||
* @return true if synchronizing
|
||||
*/
|
||||
public static boolean isSynchronizing() {
|
||||
return isSynchronizing.get();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user