Vector35 / snippets

plugin for storing and using snippets of useful Binja script
MIT License
22 stars 9 forks source link

Issue reopening snippet editor (and work around) #46

Open CunningLogic opened 9 months ago

CunningLogic commented 9 months ago

Open binary Open snippet editor Run Snippet Close Snippet editor Close binary Open binary Attempt to open snippet editor

[Default] Traceback (most recent call last):
[Default]   File "/home/jcase/.binaryninja/repositories/official/plugins/Vector35_snippets/__init__.py", line 764, in launchPlugin
[Default]     snippets.show()
[Default] RuntimeError: Internal C++ object (Snippets) already deleted.
def launchPlugin(context):
    global snippets
    if not snippets:
        snippets = Snippets(context, parent=context.widget)  
    snippets.show()

adding a try except to snippets.show, and recreating the object on exception fixes it for me (I acknowledge that is not going to be the correct fix)


def launchPlugin(context):
    global snippets
    if not snippets:
        snippets = Snippets(context, parent=context.widget)
    try:   
        snippets.show()
    except:
        snippets = Snippets(context, parent=context.widget)