zarathoustra Posted December 22, 2009 Share Posted December 22, 2009 File: C:\Program Files\Paint.NET\Effects\SegmentImage.dll Name: SegmentImageEffect.SegmentImageEffectPlugin Version: 1.0.3603.375 Author: Neil Cassidy Copyright: Copyright © Neil Cassidy Website: http://www.getpaint.net/redirect/plugins.html Full error message: System.NullReferenceException: Object reference not set to an instance of an object. at PaintDotNet.Menus.EffectMenuBase.RunEffectImpl(Type effectType) in D:\src\pdn\paintdotnet\src\PaintDotNet\Menus\EffectMenuBase.cs:line 851 Repro: 1) open PDN 2) open segment image plugin 3) cancel effect immedialty 4) drop a png picture in pdn 5) click "open" 6) wait and get the error. Status: Repros everytime for me. Complete guess: PDN might have a race condition somewhere around that, cause neil's nice effect takes ages in the initialization step of the effect. Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 23, 2009 Share Posted December 23, 2009 This is a good catch with excellent repro steps ... thanks. This has brought to my attention a new class of bugs, in fact. In the next update, expect this to work better. What is happening is that the UI is waiting for the effect plugin to finish up some stuff that is taking a very long time (ask the plugin author!). However, WinForms (and almost all other UI frameworks for that matter) continues to "pump messages" during this wait operation. One of the messages is, "hey the user did some drag-and-drop, want this stuff?" and Paint.NET is happy to oblige. This then causes some incorrectly nested message loops, and things just crumble. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
zarathoustra Posted December 23, 2009 Author Share Posted December 23, 2009 Yea, neil's effect is slow, it also gives the feeling that he's breaking the progress bar, if you look carefully. But he had no choice here, he has to heavily analyze the picture for doing this (doing k-means to classify pixels), and it mostly makes sense in the init step. I checked his code, and it's just a case where computing the function to apply to the image is slow as hell whereas applying the function is fast. Actually, in his case, it would make sence to have a progress bar for initialization, and no progress bar for applying the effect. (not saying that progress bar should be removed) Nevertheless, his plugin is pretty cool and the effect really nice, and has good quality. Do you know already, how you are going to fix that ? Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted December 23, 2009 Share Posted December 23, 2009 I have a fix in place already. If the effect is still "busy" after the users clicks Cancel, then a dialog will come up that says "Cancelling..." with a marquee (indeterminate) progress bar. This is similar to what happens if you open a large image, then Save As -> and use the DirectDraw Surface type, and immediately click OK or Cancel on the Save Config dialog. Optimally I would/will also set a flag so that the effect can know that a cancel or restart has been signaled. Ed Harvey was asking for this too, awhile ago. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
Guest boyhailong Posted April 7, 2011 Share Posted April 7, 2011 oh, it's useful to me. thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.