Skip to content
This repository has been archived by the owner on Dec 12, 2019. It is now read-only.

Draw a region, then click the place outside the region without mouse-up, try to drag, CARTA will crash #161

Open
grimmer0125 opened this issue Jun 6, 2017 · 7 comments

Comments

@grimmer0125
Copy link
Contributor

grimmer0125 commented Jun 6, 2017

Crash on casacore libs.
https://github.com/casacore/casacore/blob/v2.2/lattices/LRegions/LCBox.cc#L238

Warning: Qt has caught an exception thrown from an event handler. Throwing

exceptions from an event handler is not supported in Qt.

You must not let any exception whatsoever propagate through Qt code.

If that is not possible, in Qt 5 you must at least reimplement

QCoreApplication::notify() and catch all exceptions there.

 ((null):0, (null))

Critical: Exception(std::runtime_error)! LCBox::LCBox - blc [599, 1094] must be <= trc [511, 1301]

void Region::handleDrag( const Carta::Lib::InputEvents::Drag2Event& ev, const QPointF& location ){

after executaing this, then crash

handleDragDone

}

@grimmer0125 grimmer0125 added this to the Release v0.9 milestone Jun 6, 2017
@low-sky low-sky closed this as completed Jun 20, 2017
@low-sky low-sky reopened this Jun 20, 2017
@JamieDass
Copy link
Contributor

I just want to check, is this issue still open? I think this should have been resolved in this commit which introduced the region UI changes and bug fixes.
I can't reproduce this crash with a recent build.

@kswang1029
Copy link
Contributor

I tested with a build (dev branch) on June 19 and it seems that moving a region around will not trigger the crash event anymore. I will keep an eye on it.

@kswang1029
Copy link
Contributor

OK, I got the crash now. When you have TWO regions created, somehow you can move the two regions at the same time and one region may move completely outside the image and trigger the crash.

I suggest we should limit the regions to be completely inside the image. In other words, all pixels inside a region should have pixel values (including nan, the masked out pixels).

[41mFatal: Exception (std::exception): Exception: Ellipsoid lies completely outside the lattice.
... thrown by casacore::Slicer casacore::LCEllipsoid::makeBox(const Vector &, const casacore::IPosition &) at File: /Users/travis/build/CARTAvis/CARTAvis-externals/ThirdParty/casa/trunk/casacore/lattices/LRegions/LCEllipsoid.cc, line: 296
...caught in MyQapp::nofify()
(/Users/travis/build/CARTAvis/CARTAvis/carta/cpp/core/MyQApp.cpp:45, virtual bool MyQApp::notify(QObject *, QEvent *))

@JamieDass
Copy link
Contributor

Ah ok. That shouldn't be happening. Somehow I still can't reproduce the crash but indeed it makes no sense that regions can be outside the image.
I took a quick look at the best way to prevent this but didn't have any good ideas as the 'Region' code has no information about the image size, so I didn't see a way to limit a region's location.
I'll take another look to see how it might be done.

@low-sky
Copy link
Contributor

low-sky commented Jun 27, 2017

There are use cases for regions outside of the image. For example, you can load a region file (or mask) that is larger than a given image and would want to understand where those regions were. A common use case would be a set of markers indicating where objects of interest are. Consider also what happens when there are two images of different sizes being simultaneously analyzed.

As to whether the UI should allow the manipulation of regions outside of image, that's something that is less clear. However, I would think that this is an unnecessary limitation.

@kswang1029
Copy link
Contributor

kswang1029 commented Jun 27, 2017

An example to reproduce the crash:

  1. open HD163296_CO_2_1_mom0_zoom.image.fits (193px x 193px)
  2. open spire250_ext.fits (1931px x 2020px)
  3. in spire250_ext.fits, make a region close to the upper right edge of the image
  4. should crash immediately because that region definition will be completely outside HD163296_CO_2_1_mom0_zoom.image.fits

Note that now region is defined by pixel coordinates. Therefore if a region is defined in the smaller HD163296_CO_2_1_mom0_zoom.image.fits and then use animator to switch to the bigger spire250_ext.fits, you should see that region locates at two different places on the two images. This is the root cause to trigger the crash. That is, if two images with different pixel dimensions are opened, a valid region in one image may be invalid in another and results in crash from "casacore". If we really allow a region defined outside the image, we need to find out a way to bypass casacore crash.

@JamieDass
Copy link
Contributor

I've managed to reproduce the crash by modifying the code to allow a region to be dragged outside of the image bounds. (Previously this could only be done inadvertently by having multiple regions selected as @kswang1029 described).

As @kswang1029 says, we either have to somehow bypass the casacore crash or disallow regions outside the image bounds.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants