fixed #6664: Handle clipboard viewer crash

This commit is contained in:
Jaex 2022-12-31 13:25:32 +03:00
parent 659fd4df6e
commit 98dcab13af
3 changed files with 6 additions and 9 deletions

View file

@ -38,7 +38,10 @@ public ClipboardViewerForm()
{ {
InitializeComponent(); InitializeComponent();
ShareXResources.ApplyTheme(this); ShareXResources.ApplyTheme(this);
}
private void ClipboardViewerForm_Load(object sender, EventArgs e)
{
RefreshClipboardContentList(); RefreshClipboardContentList();
} }
@ -85,11 +88,7 @@ private void UpdateSelectedClipboardContent()
{ {
object data = CurrentDataObject.GetData(format); object data = CurrentDataObject.GetData(format);
if (data == null) if (data != null)
{
RefreshClipboardContentList();
}
else
{ {
try try
{ {

View file

@ -97,6 +97,7 @@ private void InitializeComponent()
this.Controls.Add(this.txtSelectedClipboardContent); this.Controls.Add(this.txtSelectedClipboardContent);
this.DoubleBuffered = true; this.DoubleBuffered = true;
this.Name = "ClipboardViewerForm"; this.Name = "ClipboardViewerForm";
this.Load += new System.EventHandler(this.ClipboardViewerForm_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View file

@ -247,7 +247,7 @@
<value>pbSelectedClipboardContent</value> <value>pbSelectedClipboardContent</value>
</data> </data>
<data name="&gt;&gt;pbSelectedClipboardContent.Type" xml:space="preserve"> <data name="&gt;&gt;pbSelectedClipboardContent.Type" xml:space="preserve">
<value>ShareX.HelpersLib.MyPictureBox, ShareX.HelpersLib, Version=13.2.2.0, Culture=neutral, PublicKeyToken=null</value> <value>ShareX.HelpersLib.MyPictureBox, ShareX.HelpersLib, Version=14.1.4.0, Culture=neutral, PublicKeyToken=null</value>
</data> </data>
<data name="&gt;&gt;pbSelectedClipboardContent.Parent" xml:space="preserve"> <data name="&gt;&gt;pbSelectedClipboardContent.Parent" xml:space="preserve">
<value>$this</value> <value>$this</value>
@ -264,9 +264,6 @@
<data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing"> <data name="$this.ClientSize" type="System.Drawing.Size, System.Drawing">
<value>784, 561</value> <value>784, 561</value>
</data> </data>
<data name="$this.ImeMode" type="System.Windows.Forms.ImeMode, System.Windows.Forms">
<value>NoControl</value>
</data>
<data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms"> <data name="$this.StartPosition" type="System.Windows.Forms.FormStartPosition, System.Windows.Forms">
<value>CenterScreen</value> <value>CenterScreen</value>
</data> </data>