-
Notifications
You must be signed in to change notification settings - Fork 14
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
Rawpointer removal #169
base: main
Are you sure you want to change the base?
Rawpointer removal #169
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
browser->setAttribute(Qt::WA_DeleteOnClose); | ||
} else if (dynamic_cast<CAMainWin*>(helpWidget)) { | ||
browser = static_cast<CAMainWin*>(helpWidget)->helpWidget(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use smart pointet for helpWidget too?
@@ -31,7 +31,7 @@ | |||
(eg. audio file of a theme), staff (eg. svg images in contemporary music), | |||
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") ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::make_shared
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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -459,7 +459,7 @@ bool CAMusElementFactory::configureMark(CAMusElement* elt) | |||
} | |||
|
|||
if (success) { | |||
elt->addMark(static_cast<CAMark*>(mpoMusElement)); | |||
elt->addMark(static_cast<CAMark*>(mpoMusElement.get())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should addMark() accept smart pointer as well?
Part 3: Rework of MusElement classes (unfinished)