Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed duplicate plugin not detected, #4410 #4423

Merged
merged 2 commits into from
Aug 20, 2023

Conversation

smishralm10
Copy link
Contributor

@smishralm10 smishralm10 commented May 19, 2023


Description:
This commit fixes the duplicate plugin installation issue by checking if the plugin already exists and asking user whether they would like to replace previous plugin with the new one.

@low-batt low-batt linked an issue May 20, 2023 that may be closed by this pull request
1 task
Copy link
Contributor

@low-batt low-batt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on this!

The warning from Xcode needs to be corrected.

Try this:

  • Start IINA
  • Click on Settings… under the IINA menu
  • The settings panel appears
  • On the left side of the panel click on Plugins
  • Confirm iina/plugin-userscript is not installed, if it is, uninstall and restart IINA
  • Click on Install from GitHub…
  • Select iina/plugin-userscript
  • Click Install
  • Again click Install on the Warning popup
  • Click on Install from GitHub…
  • Select iina/plugin-userscript
  • Click Install
  • This time the already exists alert appears
  • Click on OK
  • In the settings Plugins tab select User Scripts
  • Click on Uninstall
  • The Are you sure to uninstall alert appears
  • Click on OK

When I do that, this is the result:

Crash Report:
Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libswiftCore.dylib            	       0x19118e0fc closure #1 in closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 308
1   libswiftCore.dylib            	       0x19118df80 closure #1 in closure #1 in _assertionFailure(_:_:file:line:flags:) + 344
2   libswiftCore.dylib            	       0x19118d8fc _assertionFailure(_:_:file:line:flags:) + 188
3   IINA                          	       0x100e84e1c JavascriptAPISidebarView.cleanUp(_:) + 668 (JavascriptAPISidebarView.swift:26)
4   IINA                          	       0x100f08c30 closure #1 in JavascriptPluginInstance.deinit + 84 (JavascriptPluginInstance.swift:73)
5   IINA                          	       0x100f0bbd8 partial apply for closure #1 in JavascriptPluginInstance.deinit + 20
6   libswiftCore.dylib            	       0x1912283c0 Sequence.forEach(_:) + 688
7   IINA                          	       0x100f08b10 JavascriptPluginInstance.deinit + 852 (JavascriptPluginInstance.swift:73)
8   IINA                          	       0x100f08c60 JavascriptPluginInstance.__deallocating_deinit + 28
9   libswiftCore.dylib            	       0x1914f4398 _swift_release_dealloc + 56
10  libswiftCore.dylib            	       0x1914f5118 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1>>::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 132
11  libswiftCore.dylib            	       0x1914e4008 swift_arrayDestroy + 124
12  libswiftCore.dylib            	       0x1911e95d4 _ContiguousArrayStorage.__deallocating_deinit + 96
13  libswiftCore.dylib            	       0x1914f4398 _swift_release_dealloc + 56
14  libswiftCore.dylib            	       0x1914f5118 bool swift::RefCounts<swift::RefCountBitsT<(swift::RefCountInlinedness)1>>::doDecrementSlow<(swift::PerformDeinit)1>(swift::RefCountBitsT<(swift::RefCountInlinedness)1>, unsigned int) + 132
15  IINA                          	       0x100f10054 PlayerCore.plugins.setter + 100
16  IINA                          	       0x100f15034 PlayerCore.reloadPlugin(_:forced:) + 1148 (PlayerCore.swift:264)
17  IINA                          	       0x100f14848 closure #1 in static PlayerCore.reloadPluginForAll(_:) + 92 (PlayerCore.swift:235)
18  IINA                          	       0x100f14874 partial apply for closure #1 in static PlayerCore.reloadPluginForAll(_:) + 24
19  libswiftCore.dylib            	       0x1912283c0 Sequence.forEach(_:) + 688
20  IINA                          	       0x100f14568 static PlayerCore.reloadPluginForAll(_:) + 220 (PlayerCore.swift:235)
21  IINA                          	       0x100cf73f4 JavascriptPlugin.enabled.didset + 624 (JavascriptPlugin.swift:59)
22  IINA                          	       0x100cf7094 JavascriptPlugin.enabled.setter + 120
23  IINA                          	       0x100d4aef0 closure #1 in PrefPluginViewController.uninstallPlugin(_:) + 216 (PrefPluginViewController.swift:424)
24  IINA                          	       0x100ba7ce0 thunk for @escaping @callee_guaranteed (@unowned NSModalResponse) -> () + 56
25  AppKit                        	       0x185ab511c __54-[NSAlert beginSheetModalForWindow:completionHandler:]_block_invoke_2 + 40
26  AppKit                        	       0x185f2bb70 NSWindowEndWindowModalSession + 284
27  AppKit                        	       0x1858ed8a8 -[NSApplication(NSResponder) sendAction:to:from:] + 440
28  AppKit                        	       0x1858ed6c0 -[NSControl sendAction:to:] + 72
29  AppKit                        	       0x1858ed604 __26-[NSCell _sendActionFrom:]_block_invoke + 100
30  AppKit                        	       0x1858ed52c -[NSCell _sendActionFrom:] + 204
31  AppKit                        	       0x1858ed450 -[NSButtonCell _sendActionFrom:] + 88
32  AppKit                        	       0x1858eaa54 NSControlTrackMouse + 1480
33  AppKit                        	       0x1858ea460 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 144
34  AppKit                        	       0x1858ea318 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 488
35  AppKit                        	       0x1858e97e4 -[NSControl mouseDown:] + 448
36  AppKit                        	       0x1858e82cc -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 3476
37  AppKit                        	       0x185872f08 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 364
38  AppKit                        	       0x185872bc8 -[NSWindow(NSEventRouting) sendEvent:] + 284
39  AppKit                        	       0x185871f0c -[NSApplication(NSEvent) sendEvent:] + 1556
40  AppKit                        	       0x185ac1fc4 -[NSApplication _handleEvent:] + 60
41  AppKit                        	       0x185739368 -[NSApplication run] + 500
42  AppKit                        	       0x185710794 NSApplicationMain + 880
43  IINA                          	       0x100d26b98 main + 12 (AppDelegate.swift:24)
44  dyld                          	       0x1820eff28 start + 2236

Possibly this is an existing issue that just happens to be triggered by the changes. I tried, but was unable to reproduce this with IINA 1.3.1. Of course 1.3.1 incorrectly installs the plugin a second time.

More enhancement in this area is needed. IINA should detect the difference between a reinstall, which someone developing a plugin might do, or a normal user being concerned about the state of a plugin and an upgrade/downgrade. Currently during this process the user is not shown the installed version and the version of the plugin being installed. This can be treated as a separate issue.

iina/PrefPluginViewController.swift Outdated Show resolved Hide resolved
@low-batt low-batt requested a review from lhc70000 May 21, 2023 21:02
@smishralm10
Copy link
Contributor Author

smishralm10 commented May 22, 2023

Possibly this is an existing issue that just happens to be triggered by the changes.

It wasn't an existing issue and was introduced because of the changes that I made. The crash was due to the fact that the page shown was of the older plugin which was replaced, simply clearing the page fixed the issue.

Copy link
Contributor

@low-batt low-batt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the new commit I am unable to reproduce the crash. Xcode does not report a warning.

@lhc70000
Copy link
Member

Thanks a lot!

@lhc70000 lhc70000 merged commit e0dfaf0 into iina:develop Aug 20, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Duplicate plugin not detected during install
3 participants