Rawpointer removal#169
Open
suamor wants to merge 4 commits into
Open
Conversation
- Replace Raw Pointer with Smart Pointers - Change API for mainwinprogressctl (less likely to crash) - Move importFile pointer (as member)
- Resource handling uses shared pointer - Multiple raw pointers are unique pointer - Adapted interfaces
- Finish pointer replacement of control - Replace pointers for all MusElements (score) - Adapt some interfaces to avoid loss of shared pointers - Attention: Fixes some crashes but introduces new ones
matevz
requested changes
May 17, 2020
| browser = std::make_unique<CAHelpBrowser>(); | ||
| browser->setAttribute(Qt::WA_DeleteOnClose); | ||
| } else if (dynamic_cast<CAMainWin*>(helpWidget)) { | ||
| browser = static_cast<CAMainWin*>(helpWidget)->helpWidget(); |
Member
There was a problem hiding this comment.
use smart pointet for helpWidget too?
| voice etc. | ||
| You can simply add a resource by calling | ||
| CADocument::addResource( new CAResource( "/home/user/title.jpeg", "My image") ); | ||
| CADocument::addResource( make_shared<CAResource>( "/home/user/title.jpeg", "My image") ); |
| mpoMusElement = new CAClef(_eClef, staff, 0, _iClefOffset); | ||
| success = staff->voiceList()[0]->insert(right, mpoMusElement); | ||
| mpoMusElement = std::make_shared<CAClef>(_eClef, staff, 0, _iClefOffset); | ||
| success = staff->voiceList()[0]->insert(right, mpoMusElement.get()); |
Member
There was a problem hiding this comment.
What happens to QList<CAMusElement*>? Should it become QList<std::shared_ptr>? If so, we need to update swig helpers which transform QList<CAMusElement*> type to native python lists.
|
|
||
| if (success) { | ||
| elt->addMark(static_cast<CAMark*>(mpoMusElement)); | ||
| elt->addMark(static_cast<CAMark*>(mpoMusElement.get())); |
Member
There was a problem hiding this comment.
Should addMark() accept smart pointer as well?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 3: Rework of MusElement classes (unfinished)