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

NullReferenceException following search or highlight #299

Open
zhangxiaoxing opened this issue Feb 5, 2021 · 1 comment
Open

NullReferenceException following search or highlight #299

zhangxiaoxing opened this issue Feb 5, 2021 · 1 comment
Labels
🐛bug Something isn't working

Comments

@zhangxiaoxing
Copy link

Not complaining, great jobs everyone. Just FYI.

Qiqqa version:
Current version: 83
Current build: 83.0.7656.6401

The exception following search (any word, but only some pdf files) reads:

20210205065313:System.NullReferenceException: Object reference not set to an instance of an object.
   at Qiqqa.Documents.PDF.PDFControls.Page.Search.PDFSearchLayer.SetNextSearchPosition(PDFSearchResult previous_search_result_placeholder)
   at Qiqqa.Documents.PDF.PDFControls.PDFRendererControl.SetSearchKeywords(PDFSearchResultSet search_result_set)
   at Qiqqa.Documents.PDF.PDFControls.PDFReadingControl.SetSearchKeywords_EXECUTE(String search_string)
   at Qiqqa.Documents.PDF.PDFControls.PDFReadingControl.SetSearchKeywords()
   at Qiqqa.Documents.PDF.PDFControls.PDFReadingControl.TextBoxFind_OnHardSearch()
   at Utilities.GUI.AugmentedSearchBox.FireOnHardSearch()
   at Utilities.GUI.AugmentedSearchBox.TextSearch_KeyUp(Object sender, KeyEventArgs e)
   at System.Windows.Input.KeyEventArgs.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.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
   at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
   at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
   at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
   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)

--------------------------------------------

The exception following highlight then refresh (on every pdf, persistent cross multiple sessions) reads:

20210205070627:System.NullReferenceException: Object reference not set to an instance of an object.
   at Qiqqa.Documents.PDF.PDFControls.Page.Highlight.PDFHighlightLayer.PDFHighlightLayer_Loaded(Object sender, RoutedEventArgs e)
   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.RaiseEvent(RoutedEventArgs e)
   at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
   at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
   at MS.Internal.LoadedOrUnloadedOperation.DoWork()
   at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   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)

--------------------------------------------

@zhangxiaoxing
Copy link
Author

Also would like a context menu item in the library UI that clears all annotation associated with a pdf file, in case the pdf cannot be opened due to above reasons.

@GerHobbelt GerHobbelt added the 🐛bug Something isn't working label Feb 5, 2021
GerHobbelt added a commit to GerHobbelt/qiqqa-open-source that referenced this issue Feb 6, 2021
- removed the cyclic reference in the PDFRendererControlStats setup.
- added WeakReference<PDFRendererControl> instances in any sub-controls which would otherwise have caused a cyclic reference
- null-reference checking via ASSERT.Test() so that we at least can debug the bastards when we hit them.
- Added null reference checks via if(...) constructs for several controls' usage.
- added null checks for several functions which would legally return `null`, e.g. on data file load ('de-serialize') errors.

  TODO: trigger those errors forcefully for testing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants