Skip to content
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

Fix issue #1084 crash when trying delete complicated track #1085

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

donarturo11
Copy link
Contributor

Fixes issue #1084 .

@donarturo11
Copy link
Contributor Author

@terminator356 , could you review this commit, please? Thanks to this one, this program is more stable. It prevents of crashes, when object won't found in list.

@terminator356
Copy link
Member

Hi, thanks for the patch.
Unfortunately this is not the ideal solution, and is only a 'band-aid' solution.

We really need to know who is attempting to execute the operation with an invalid iterator,
and correct the problem there.
To do this, I must ask, can you post (a link to) the actual song involved, or say a 'cut-down'
version of it that still causes the problem, or else a 'mock-up' that will cause the problem?
That way I can examine every detail such as song storage and so on.

Question: The song causing the problem: Is it an old song made before 2020?
Or is it a new song made recently?
If it is an old song, you may indeed be seeing bug 887 as you originally posted... Maybe...

Thanks.
Tim.

@donarturo11
Copy link
Contributor Author

Question: The song causing the problem: Is it an old song made before 2020?

This song was created in summer 2022.

@donarturo11
Copy link
Contributor Author

To do this, I must ask, can you post (a link to) the actual song involved,

muzyka_na_smyczki_noSynth.med

@donarturo11
Copy link
Contributor Author

Unfortunately this is not the ideal solution, and is only a 'band-aid' solution.

I tested another solution:

if(_imcv == _mcvl->begin())
          _mcvl->erase(_imcv);

Too runs. I thought about submit but I don't know if _imcv can be on another place of _mcvl.
I wrote a simple text function to check, when _imcv is present in _mcvl and I noticed that when _mcvl tries to erase not existing item, program crashes. So I think that good way is to check if item is in list, then if condition is true, erase.

@donarturo11
Copy link
Contributor Author

Which better way to check if item is valid do you propose. In my humble opinion, direct erasing shouldn't be leave, because original solution is not as safe.

@donarturo11
Copy link
Contributor Author

I found a problematic block. Inside original song, trying to remove crashes program, but this block imported to new files, crashes after moving.
test1.mpt

@donarturo11
Copy link
Contributor Author

@terminator356 I removed loop and used method void delMCtlVal(unsigned int tick, Part* part, int val/* = -1*/); .
Now this line looks: _mcvl->delMCtlVal(_imcv->first, _imcv->second.part, _imcv->second.val); .
Runs well. In my opinion it should be a a better solution.

@donarturo11
Copy link
Contributor Author

I think yet about reimplement the method erase inside MidiCtrlValue. It would be as override.

@donarturo11
Copy link
Contributor Author

@terminator356 I found yet another solution. I reverted _mcvl->erase(_imcl) in line 1282 of operation.cpp and uncommented line 35 of midictrl.h #define _MIDI_CTRL_METHODS_DEBUG_ and the program didn't crash while delete track.
I would like to ask if is any reason of optionally turn on this definition, and it won't better to remove #ifdef _MIDI_CTRL_METHODS_DEBUG_ conditional?

@donarturo11
Copy link
Contributor Author

@terminator356 So I removed the commit with searching loop and replaced erase. Could you review the code after changes, please? If do you want to leave erase method in operations.cpp, maybe better enable debug methods as default in midictrl?
I shared entire directory on Dropbox

@donarturo11 donarturo11 changed the title Implement checking if erase of element from list is possible Change method to safer Sep 13, 2022
@donarturo11
Copy link
Contributor Author

@terminator356 Well, what you think about latest commit: Use another method to erase item? Now it is good to merge?

@donarturo11 donarturo11 changed the title Change method to safer Crash when trying delete complicated track Sep 14, 2022
@donarturo11 donarturo11 changed the title Crash when trying delete complicated track Fix crash when trying delete complicated track Sep 14, 2022
@donarturo11 donarturo11 changed the title Fix crash when trying delete complicated track Fix issue #1084 crash when trying delete complicated track Sep 14, 2022
@terminator356
Copy link
Member

Hi, sorry for the delay, I am studying the matter and should have an answer this weekend.

@donarturo11
Copy link
Contributor Author

@terminator356 Sorry if I'm asking here. Do contributors use any platform like Discord or IRC? I know that comments below issues or pull requests are not good place for such discussions. A very good example is Developer group chat in MuseScore project.

@terminator356
Copy link
Member

Hi @donarturo11
I have found several problems in our code. I am working to fix them.
I also found some bugs that, when fixed, should fix some features that were broken for a long time.
Please wait... Thanks.

@donarturo11 donarturo11 marked this pull request as draft September 29, 2022 13:39
@donarturo11 donarturo11 marked this pull request as ready for review September 29, 2022 13:40
@luzpaz
Copy link
Contributor

luzpaz commented Sep 21, 2023

Any progress here ?

@devloop0123
Copy link

devloop0123 commented Apr 20, 2024

Excuse me for intruding, but the problem with donarturo11's test1.mpt is that it contains (multiple) identical simultaneous events. Removing the duplicates with
awk '!seen[$0]++' test1.mpt > test2.mpt
fixes the part.

If I create a part with a single cc event, and duplicate that event in the .mpt file, like
event tick="1536" type="1" a="1" b="102"
event tick="1536" type="1" a="1" b="102"
then attempting to do anything (moving, deleting, cutting) with this imported part crashes MusE.
If any one of those 4 event parameters is different, then there's no crash anymore.

So the problem is not the complicated track, but duplicate events.

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

Successfully merging this pull request may close these issues.

4 participants