saulgreenberg / TimelapseDeprecatedPre2.3

Timelapse Image Analysis Tool
Other
1 stars 0 forks source link

Bug when selecting (filtering) in the ClickabelImagesGrid #43

Closed saulgreenberg closed 6 years ago

saulgreenberg commented 6 years ago

• I believe I fixed the error (ie. The symptom) vs. the cause, where SwitchToClickableGridView() was calling this.DataEntryControls.SetEnableState (and others) when it was already in view. Just in case the problem still exists elsewhere, here are my comments. • To illustrate bug: o Read and Uncomment the debug.prints (or remove catch) in DataEntryHandler.cs GetValueDisplayStringCommonToFileIds o Load large image set o Navigate to somewhere other than the beginning o In overview, select several and set them to dark o In overview, navigate to a different place o In overview, select Dark Images  Bug should appear. • Stack trace:  TimelapseWIndow.xaml.cs: SelectFilesAndShowFile(long imageID,… • this.ShowFile(this.dataHandler.FileDatabase.GetFileOrNextFileIndex(imageID));  MarkableCanvas.cs: SwitchToClickableGridView() • this.DataEntryControls.SetEnableState(Controls.ControlsEnableState.MultipleImageView,  DataEntryContols.Zaml.cs: public void SetEnableState(ControlsEnableState controlsToEnable, • *.SetContentAndTooltip(this.dataEntryHandler.GetValueDisplayStringCommonToFileIds(note.DataLabel) o Argument: this.dataEntryHandler.GetValueDisplayStringCommonToFileIds(note.DataLabel)  DataEntryHandler.cs: public string GetValueDisplayStringCommonToFileIds(string dataLabel) • ImageRow imageRow = this.FileDatabase.Files[fileIds[0]]; o The above fails on this.FileDatabase.Files, as fileIds[0] is not a valid array index. This will thus produce an error in Trow, as the index is out of range. o Currently caught as a try/catch, but I really need to find out why fileIds[0] is not valid. What is likely happening is:  The FileId appears to be of the old FileId of the ImageRow prior to the Select. When the select occurs, that ImageRow is no longer there, so the FileID fails.  The catch catches that, so it works. A later invocation then has the correct FileID, so it subsequently behaves as it should • Although when I do a select where only a single image matches (e.g., corrupt), the first image is not selected. Don’t know why. 
o Alternative behaviour or workaround, currently commented out
 in TimelapeWindowlxaml.cs: SelectFilesAndShowFile(… simly switches to the SingleImageView after any selection. We could use that instead.