fix: endless loop issue

This commit is contained in:
2020-05-26 08:56:59 +08:00
parent ee0c6130a8
commit 9c87b3e7ea
4 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0.525" package="org.tsanie.pixiview" android:versionCode="20"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0.526" package="org.tsanie.pixiview" android:versionCode="21">
<uses-sdk android:minSdkVersion="25" android:targetSdkVersion="28" /> <uses-sdk android:minSdkVersion="25" android:targetSdkVersion="28" />
<application android:label="Pixiview" android:icon="@mipmap/icon" android:roundIcon="@mipmap/icon_round"></application> <application android:label="Pixiview" android:icon="@mipmap/icon" android:roundIcon="@mipmap/icon_round"></application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

View File

@ -29,8 +29,8 @@
<string>com.apple.share-services</string> <string>com.apple.share-services</string>
</dict> </dict>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.525</string> <string>1.0.526</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>20</string> <string>21</string>
</dict> </dict>
</plist> </plist>

View File

@ -79,9 +79,9 @@
</dict> </dict>
</array> </array>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>1.0.525</string> <string>1.0.526</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>20</string> <string>21</string>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>China</string> <string>China</string>
</dict> </dict>

View File

@ -78,14 +78,14 @@ namespace Pixiview.Illust
protected string lastError; protected string lastError;
private readonly object sync = new object(); private readonly object sync = new object();
private readonly Queue<ParallelTask> tasks; private readonly Stack<ParallelTask> tasks;
private T illustData; private T illustData;
public IllustCollectionPage() public IllustCollectionPage()
{ {
commandIllustImageTapped = new Command<IllustItem>(OnIllustImageTapped); commandIllustImageTapped = new Command<IllustItem>(OnIllustImageTapped);
commandUserTapped = new Command<IIllustItem>(OnIllustUserItemTapped); commandUserTapped = new Command<IIllustItem>(OnIllustUserItemTapped);
tasks = new Queue<ParallelTask>(); tasks = new Stack<ParallelTask>();
BindingContext = this; BindingContext = this;
} }
@ -122,7 +122,7 @@ namespace Pixiview.Illust
{ {
lock (sync) lock (sync)
{ {
while (tasks.TryDequeue(out var task)) while (tasks.TryPop(out var task))
{ {
if (task != null) if (task != null)
{ {
@ -675,7 +675,7 @@ namespace Pixiview.Illust
if (peek.TagIndex >= tag) if (peek.TagIndex >= tag)
{ {
App.DebugPrint($"tasks expired ({tasks.Count}), peek: {peek.TagIndex}, now: {tag}, will be disposing."); App.DebugPrint($"tasks expired ({tasks.Count}), peek: {peek.TagIndex}, now: {tag}, will be disposing.");
while (tasks.TryPeek(out var t)) while (tasks.TryPop(out var t))
{ {
if (t != null) if (t != null)
{ {
@ -721,7 +721,7 @@ namespace Pixiview.Illust
{ {
lock (sync) lock (sync)
{ {
tasks.Enqueue(task); tasks.Push(task);
} }
} }
} }