Program: 38359
Project: 38359
Buggy source:
public void updateSupportedOperation(){
  if (mMenuTask != null)   mMenuTask.cancel();
  updateSelectionMenu();
  if (mSharePanoramaMenuItem != null)   mSharePanoramaMenuItem.setEnabled(false);
  if (mShareMenuItem != null)   mShareMenuItem.setEnabled(false);
  mMenuTask=mActivity.getThreadPool().submit(new Job<Void>(){
    @Override public Void run(    final JobContext jc){
      ArrayList<MediaObject> selected=getSelectedMediaObjects(jc);
      if (selected == null) {
        mMainHandler.post(new Runnable(){
          @Override public void run(){
            mMenuTask=null;
            if (jc.isCancelled())             return;
            MenuExecutor.updateMenuOperation(mMenu,0);
          }
        }
);
        return null;
      }
      final int operation=computeMenuOptions(selected);
      if (jc.isCancelled()) {
        return null;
      }
      final GetAllPanoramaSupports supportCallback=new GetAllPanoramaSupports(selected,jc);
      final Intent share_panorama_intent=computePanoramaSharingIntent(jc);
      final Intent share_intent=computeSharingIntent(jc);
      supportCallback.waitForPanoramaSupport();
      if (jc.isCancelled()) {
        return null;
      }
      mMainHandler.post(new Runnable(){
        @Override public void run(){
          mMenuTask=null;
          if (jc.isCancelled())           return;
          MenuExecutor.updateMenuOperation(mMenu,operation);
          MenuExecutor.updateMenuForPanorama(mMenu,supportCallback.mAllPanorama360,supportCallback.mHasPanorama360);
          if (mSharePanoramaMenuItem != null) {
            mSharePanoramaMenuItem.setEnabled(true);
            if (supportCallback.mAllPanorama360) {
              mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
              mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share_as_photo));
            }
 else {
              mSharePanoramaMenuItem.setVisible(false);
              mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
              mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share));
            }
            mSharePanoramaActionProvider.setShareIntent(share_panorama_intent);
          }
          if (mShareMenuItem != null) {
            mShareMenuItem.setEnabled(true);
            mShareActionProvider.setShareIntent(share_intent);
          }
        }
      }
);
      return null;
    }
  }
);
}

Fixed version (ground truth):
public void updateSupportedOperation(){
  if (mMenuTask != null)   mMenuTask.cancel();
  updateSelectionMenu();
  if (mSharePanoramaMenuItem != null)   mSharePanoramaMenuItem.setEnabled(false);
  if (mShareMenuItem != null)   mShareMenuItem.setEnabled(false);
  mMenuTask=mActivity.getThreadPool().submit(new Job<Void>(){
    @Override public Void run(    final JobContext jc){
      ArrayList<MediaObject> selected=getSelectedMediaObjects(jc);
      if (selected == null) {
        mMainHandler.post(new Runnable(){
          @Override public void run(){
            mMenuTask=null;
            if (jc.isCancelled())             return;
            MenuExecutor.updateMenuOperation(mMenu,0);
          }
        }
);
        return null;
      }
      final int operation=computeMenuOptions(selected);
      if (jc.isCancelled()) {
        return null;
      }
      int numSelected=selected.size();
      final boolean canSharePanoramas=numSelected < MAX_SELECTED_ITEMS_FOR_PANORAMA_SHARE_INTENT;
      final boolean canShare=numSelected < MAX_SELECTED_ITEMS_FOR_SHARE_INTENT;
      final GetAllPanoramaSupports supportCallback=canSharePanoramas ? new GetAllPanoramaSupports(selected,jc) : null;
      final Intent share_panorama_intent=canSharePanoramas ? computePanoramaSharingIntent(jc,MAX_SELECTED_ITEMS_FOR_PANORAMA_SHARE_INTENT) : new Intent();
      final Intent share_intent=canShare ? computeSharingIntent(jc,MAX_SELECTED_ITEMS_FOR_SHARE_INTENT) : new Intent();
      if (canSharePanoramas) {
        supportCallback.waitForPanoramaSupport();
      }
      if (jc.isCancelled()) {
        return null;
      }
      mMainHandler.post(new Runnable(){
        @Override public void run(){
          mMenuTask=null;
          if (jc.isCancelled())           return;
          MenuExecutor.updateMenuOperation(mMenu,operation);
          MenuExecutor.updateMenuForPanorama(mMenu,canSharePanoramas && supportCallback.mAllPanorama360,canSharePanoramas && supportCallback.mHasPanorama360);
          if (mSharePanoramaMenuItem != null) {
            mSharePanoramaMenuItem.setEnabled(true);
            if (canSharePanoramas && supportCallback.mAllPanorama360) {
              mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
              mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share_as_photo));
            }
 else {
              mSharePanoramaMenuItem.setVisible(false);
              mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
              mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share));
            }
            mSharePanoramaActionProvider.setShareIntent(share_panorama_intent);
          }
          if (mShareMenuItem != null) {
            mShareMenuItem.setEnabled(canShare);
            mShareActionProvider.setShareIntent(share_intent);
          }
        }
      }
);
      return null;
    }
  }
);
}