Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic LBC + RBC null ref exception (Read 3321 times)
lexeranddn
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Nov 30th, 2018
LBC + RBC null ref exception
Dec 4th, 2018 at 10:23am
Print Post  
we use context menu on Diagram to choose between select and pan mode, and if we clicking quickly LBC + RBC several times we can catch exception, stack trace the following

   at MindFusion.Diagramming.Wpf.Diagram.QS(MouseButtonEventArgs K, Point N)
   at MindFusion.Diagramming.Wpf.Diagram.OnPreviewMouseDown(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnPreviewMouseDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 2157
Joined: Oct 19th, 2005
Re: LBC + RBC null ref exception
Reply #1 - Dec 4th, 2018 at 12:19pm
Print Post  
Try calling diagram.CancelDrag() before showing the context menu. If it doesn't help, please post diagram initialization code and respective event handlers, or attach a test project reproducing that.
  
Back to top
 
IP Logged
 
lexeranddn
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Nov 30th, 2018
Re: LBC + RBC null ref exception
Reply #2 - Dec 5th, 2018 at 12:16pm
Print Post  
Looks like it helps, thanks!
  
Back to top
 
IP Logged
 
lexeranddn
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Nov 30th, 2018
Re: LBC + RBC null ref exception
Reply #3 - Dec 5th, 2018 at 1:31pm
Print Post  
I'm sorry, actually it does not work, before I try to make test example:
one more point to reproduce, we declare for diagram dependency property

        public object MenuItemIsCheckedPan
        {
            get => GetValue(MenuItemIsCheckedPanProperty);
            set => SetValue(MenuItemIsCheckedPanProperty, value);
        }

        public static readonly DependencyProperty MenuItemIsCheckedPanProperty =
            DependencyProperty.Register(nameof(MenuItemIsCheckedPan), typeof(object), typeof(StructureEditor),
                new PropertyMetadata(null));

and problem is reproducing when this property in true state.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 2157
Joined: Oct 19th, 2005
Re: LBC + RBC null ref exception
Reply #4 - Dec 6th, 2018 at 8:39am
Print Post  
And what does MenuItemIsCheckedPan do when enabled - does it set diagram.Behavior to Pan?
  
Back to top
 
IP Logged
 
lexeranddn
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Nov 30th, 2018
Re: LBC + RBC null ref exception
Reply #5 - Dec 6th, 2018 at 2:51pm
Print Post  
Yes, behaviour changes on MouseMove callback
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Online


tech.support

Posts: 2157
Joined: Oct 19th, 2005
Re: LBC + RBC null ref exception
Reply #6 - Dec 6th, 2018 at 4:28pm
Print Post  
Have you also tried calling CancelDrag from that MouseMove callback?
  
Back to top
 
IP Logged
 
lexeranddn
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 13
Joined: Nov 30th, 2018
Re: LBC + RBC null ref exception
Reply #7 - Dec 7th, 2018 at 10:49am
Print Post  
Great! That works!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint