-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Application Crashes when scrolling through Annotation Markers with the mouse on PC version #2041
Comments
Can't reproduce on Windows or Ubuntu 22.04. Don't know why the widget would signal a value of -1 anyway - in the code pasted, you can see ui->aMarker->setMinimum(0); an the .ui file has a minimum of 0 as well. Perhaps a sign of something else going wrong? |
Before I fixed it in my repo, I could reliably duplicate the issue by scrolling the wheel down until the value goes negative In general, independently of whether the crash is reproducible, the method
must check for the value to be valid before assigning it to the class' member variable, independently of what checks may or may not exist upstream of the call. |
Must it? If Qt guarantees that the slots are only called with valid values, then it's a waste of CPU/typing to check it again. If Qt doesn't guarantee it, then there's probably a lot of other places that need to be changed as well. Looks like the Qt code should apply the bounds before signalling: |
It should, according to any good software engineering practices. Any inputs of a public method should be checked for validity, if possible. It must in my field of software engineering, otherwise bad things could happen. You may not believe me that I could replicate a crash, but I could. Otherwise I would not be wasting anybody's time reporting it. Since it did crash for me (repeatedly and consistently, enough for me to find and fix the issue), and gdb reported that the value of m_annotationMarkerIndex was -1, somehow it got assigned that. It's possible, the method was called directly (outside of Qt's signal-slot mechanism) or the mouse wheel interface combined with custom circular spin element does not properly setup boundaries, the crush does occur and to fix it, is to guard the values of m_annotationMarkerIndex each time it is being set. Would you like me to provide the exact call trace of -1 being set to m_annotationMarkerIndex. I was hoping to avoid that work as it would distract me from my main goal of figuring out a signal. I assumed, I provided enough information for a quick and easy fix that would improve the overall quality of this marvelous app. |
I believe it crashed, I just want to understand why you're getting -1, so we know if that is indeed the most appropriate fix and where else it might need to be applied. Yes, a call trace would help, thanks. |
I rolled back my changes and attempted to duplicate the issue to get the stack trace. I was unable to do so. I will continue working with markers to see if I can identify the sequence that causes the crash. |
This issue is going to be closed due to inactivity |
Version: 7.19.0
Steps to reproduce:
-- Create several annotation markers (or load from CSV).
-- Select show annotations from the pull down
-- Point mouse pointer to the wheel to switch through markers, Scroll up and down, the index hits -1 and the application crashes
GDB output of the crash:
Suggested fix (git patch format):
The text was updated successfully, but these errors were encountered: