Vector35 / binaryninja-api

Public API, examples, documentation and issues for Binary Ninja
https://binary.ninja/
MIT License
900 stars 204 forks source link

Error related to notification_barrier when using BinaryDataNotification #4558

Closed kristopax closed 1 year ago

kristopax commented 1 year ago

Version and Platform (required):

Bug Description: When using the BinaryDataNotification class within a plugin (namely Sidekick), the following error now occurs:

Exception ignored on calling ctypes callback function: <bound method BinaryDataNotificationCallbacks._notification_barrier of <binaryninja.binaryview.BinaryDataNotificationCallbacks object at 0x28b75c550>>
Traceback (most recent call last):
  File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/binaryview.py", line 521, in _notification_barrier
    self._notify.notification_barrier(self._view)
TypeError: notification_barrier() missing 1 required positional argument: 'view'
Exception ignored on calling ctypes callback function: <bound method BinaryDataNotificationCallbacks._notification_barrier of <binaryninja.binaryview.BinaryDataNotificationCallbacks object at 0x28b75c550>>
Traceback (most recent call last):
  File "/Applications/Binary Ninja.app/Contents/MacOS/plugins/../../Resources/python/binaryninja/binaryview.py", line 521, in _notification_barrier
    self._notify.notification_barrier(self._view)
TypeError: notification_barrier() missing 1 required positional argument: 'view'

Steps To Reproduce: Please provide all steps required to reproduce the behavior:

  1. Open up binary ninja
  2. Install sidekick (if not already installed)
  3. Open any binary
  4. Open the Sidekick Suggestions Sidebar
  5. Observe error

Expected Behavior: No error should have been generated.

Screenshots: image

Additional Information: We can make the following changes to fix the issue:

In binaryview.py:

        def _notification_barrier(self, ctxt, view: core.BNBinaryView) -> int:
        try:
            return self._notify.notification_barrier(self._view)
        except OSError:
            log_error(traceback.format_exc())

and

          def notification_barrier(self, view) -> int:
        return 0
bpotchik commented 1 year ago

Fixed in 3.5.4445-dev.