Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
极致猎手
jadx
提交
98c0416b
J
jadx
项目概览
极致猎手
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
98c0416b
编写于
5月 28, 2022
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(gui): correct close and reopen for decompiler and cache
上级
fa41874e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
40 addition
and
33 deletion
+40
-33
jadx-core/src/main/java/jadx/api/JadxArgs.java
jadx-core/src/main/java/jadx/api/JadxArgs.java
+17
-0
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
+5
-5
jadx-gui/src/main/java/jadx/gui/JadxWrapper.java
jadx-gui/src/main/java/jadx/gui/JadxWrapper.java
+12
-22
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+6
-6
未找到文件。
jadx-core/src/main/java/jadx/api/JadxArgs.java
浏览文件 @
98c0416b
...
...
@@ -12,6 +12,9 @@ import java.util.Set;
import
java.util.function.Function
;
import
java.util.function.Predicate
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
jadx.api.args.DeobfuscationMapFileMode
;
import
jadx.api.data.ICodeData
;
import
jadx.api.impl.AnnotatedCodeWriter
;
...
...
@@ -19,6 +22,7 @@ import jadx.api.impl.InMemoryCodeCache;
import
jadx.core.utils.files.FileUtils
;
public
class
JadxArgs
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
JadxArgs
.
class
);
public
static
final
int
DEFAULT_THREADS_COUNT
=
Math
.
max
(
1
,
Runtime
.
getRuntime
().
availableProcessors
()
/
2
);
...
...
@@ -122,6 +126,19 @@ public class JadxArgs {
setOutDirRes
(
new
File
(
rootDir
,
DEFAULT_RES_DIR
));
}
public
void
close
()
{
try
{
inputFiles
.
clear
();
if
(
codeCache
!=
null
)
{
codeCache
.
close
();
}
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Failed to close JadxArgs"
,
e
);
}
finally
{
codeCache
=
null
;
}
}
public
List
<
File
>
getInputFiles
()
{
return
inputFiles
;
}
...
...
jadx-core/src/main/java/jadx/api/JadxDecompiler.java
浏览文件 @
98c0416b
...
...
@@ -161,8 +161,13 @@ public final class JadxDecompiler implements Closeable {
classesMap
.
clear
();
methodsMap
.
clear
();
fieldsMap
.
clear
();
}
@Override
public
void
close
()
{
reset
();
closeInputs
();
args
.
close
();
}
private
void
closeInputs
()
{
...
...
@@ -176,11 +181,6 @@ public final class JadxDecompiler implements Closeable {
loadedInputs
.
clear
();
}
@Override
public
void
close
()
{
reset
();
}
private
void
loadPlugins
(
JadxArgs
args
)
{
pluginManager
.
providesSuggestion
(
"java-input"
,
args
.
isUseDxInput
()
?
"java-convert"
:
"java-input"
);
pluginManager
.
load
();
...
...
jadx-gui/src/main/java/jadx/gui/JadxWrapper.java
浏览文件 @
98c0416b
...
...
@@ -10,7 +10,6 @@ import org.jetbrains.annotations.Nullable;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
jadx.api.ICodeCache
;
import
jadx.api.JadxArgs
;
import
jadx.api.JadxDecompiler
;
import
jadx.api.JavaClass
;
...
...
@@ -19,7 +18,6 @@ import jadx.api.ResourceFile;
import
jadx.api.impl.InMemoryCodeCache
;
import
jadx.core.dex.nodes.ClassNode
;
import
jadx.core.dex.nodes.ProcessState
;
import
jadx.core.utils.exceptions.JadxRuntimeException
;
import
jadx.core.utils.files.FileUtils
;
import
jadx.gui.settings.JadxProject
;
import
jadx.gui.settings.JadxSettings
;
...
...
@@ -40,7 +38,6 @@ public class JadxWrapper {
public
JadxWrapper
(
MainWindow
mainWindow
)
{
this
.
mainWindow
=
mainWindow
;
this
.
decompiler
=
new
JadxDecompiler
(
new
JadxArgs
());
}
public
void
open
()
{
...
...
@@ -53,7 +50,7 @@ public class JadxWrapper {
this
.
decompiler
=
new
JadxDecompiler
(
jadxArgs
);
this
.
decompiler
.
load
();
initCodeCache
(
jadxArgs
);
initCodeCache
();
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Jadx init error"
,
e
);
close
();
...
...
@@ -71,23 +68,27 @@ public class JadxWrapper {
public
void
close
()
{
try
{
decompiler
.
close
();
closeCodeCache
();
if
(
decompiler
!=
null
)
{
decompiler
.
close
();
mainWindow
.
getCacheObject
().
reset
();
}
}
catch
(
Exception
e
)
{
LOG
.
error
(
"jadx decompiler close error"
,
e
);
LOG
.
error
(
"Jadx decompiler close error"
,
e
);
}
finally
{
decompiler
=
null
;
}
}
private
void
initCodeCache
(
JadxArgs
jadxArgs
)
{
private
void
initCodeCache
()
{
switch
(
getSettings
().
getCodeCacheMode
())
{
case
MEMORY:
jadxArgs
.
setCodeCache
(
new
InMemoryCodeCache
());
getArgs
()
.
setCodeCache
(
new
InMemoryCodeCache
());
break
;
case
DISK_WITH_CACHE:
jadxArgs
.
setCodeCache
(
new
CodeStringCache
(
buildBufferedDiskCache
()));
getArgs
()
.
setCodeCache
(
new
CodeStringCache
(
buildBufferedDiskCache
()));
break
;
case
DISK:
jadxArgs
.
setCodeCache
(
buildBufferedDiskCache
());
getArgs
()
.
setCodeCache
(
buildBufferedDiskCache
());
break
;
}
}
...
...
@@ -97,17 +98,6 @@ public class JadxWrapper {
return
new
BufferCodeCache
(
diskCache
);
}
public
void
closeCodeCache
()
{
ICodeCache
codeCache
=
getArgs
().
getCodeCache
();
if
(
codeCache
!=
null
)
{
try
{
codeCache
.
close
();
}
catch
(
Exception
e
)
{
throw
new
JadxRuntimeException
(
"Error on cache close"
,
e
);
}
}
}
/**
* Get the complete list of classes
*/
...
...
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
浏览文件 @
98c0416b
...
...
@@ -387,6 +387,8 @@ public class MainWindow extends JFrame {
}
public
void
reopen
()
{
saveAll
();
closeAll
();
loadFiles
(
EMPTY_RUNNABLE
);
}
...
...
@@ -431,6 +433,7 @@ public class MainWindow extends JFrame {
private
void
closeAll
()
{
cancelBackgroundJobs
();
clearTree
();
resetCache
();
LogCollector
.
getInstance
().
reset
();
wrapper
.
close
();
tabbedPane
.
closeAllTabs
();
...
...
@@ -606,7 +609,6 @@ public class MainWindow extends JFrame {
private
void
clearTree
()
{
tabbedPane
.
reset
();
resetCache
();
treeRoot
=
null
;
treeModel
.
setRoot
(
null
);
treeModel
.
reload
();
...
...
@@ -1329,7 +1331,7 @@ public class MainWindow extends JFrame {
}
private
void
closeWindow
()
{
save
OpenTabs
();
save
All
();
if
(!
ensureProjectIsSaved
())
{
return
;
}
...
...
@@ -1339,13 +1341,11 @@ public class MainWindow extends JFrame {
if
(
debuggerPanel
!=
null
)
{
saveSplittersInfo
();
}
cancelBackgroundJobs
();
wrapper
.
close
();
heapUsageBar
.
reset
();
dispose
();
closeAll
();
BreakpointManager
.
saveAndExit
();
FileUtils
.
deleteTempRootDir
();
dispose
();
System
.
exit
(
0
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录