open-cogsci / opensesame-extension-osf

Open Science Framework module for OpenSesame3
Other
4 stars 1 forks source link

Exception when working with explorer widget #9

Closed smathot closed 8 years ago

smathot commented 8 years ago

I was working with the OSF explorer widget in OpenSesame, linking an experiment to the OSF, and suddenly received this error. I'm not sure where it comes from, or what I did to trigger it exactly. But my best bet is that some race condition occurred with refreshing the explorer tree.

Traceback (most recent call last):
  File "/home/sebastiaan/git/QOpenScienceFramework/QOpenScienceFramework/manager.py", line 395, in <lambda>
    callback, *args, **kwargs
  File "/home/sebastiaan/git/QOpenScienceFramework/QOpenScienceFramework/manager.py", line 854, in __reply_finished
    callback(reply, *args, **kwargs)
  File "/home/sebastiaan/git/QOpenScienceFramework/QOpenScienceFramework/widgets/osfexplorer.py", line 1056, in __upload_refresh_item
    after_upload_cb(*args, **kwargs)
  File "/home/sebastiaan/git/opensesame-extension-osf/opensesame_extensions/OpenScienceFramework/OpenScienceFramework.py", line 1655, in __link_experiment_succeeded
    self.unmark_treewidget_item(self.linked_experiment_treewidgetitem)
  File "/home/sebastiaan/git/opensesame-extension-osf/opensesame_extensions/OpenScienceFramework/OpenScienceFramework.py", line 639, in unmark_treewidget_item
    font = item.font(0)
RuntimeError: wrapped C/C++ object of type QTreeWidgetItem has been deleted
dschreij commented 8 years ago

Jup I've seen that one before in other situations, but though I had incorporated some security against it. I will give it a closer look

dschreij commented 8 years ago

There's not much I can do to prevent this race condition to occur, because Qt just works asynchronously like that, offering little control on what occurs first. I have however included a safeguard against these runtime errors, which gracefully aborts the operation if one occurs and just prints a warning to the console, so users should at least not be presented with these stacktraces anymore.

dschreij commented 8 years ago

Should be fixed with f10c2b3cb09bedc53bcc241d5d1d2d8bb91f174a