raw -> smart pointer for musredit where it makes sence.

This commit is contained in:
2023-10-21 22:33:19 +02:00
parent c2d2307755
commit 1117ad9732
12 changed files with 70 additions and 92 deletions

View File

@@ -91,7 +91,7 @@ PTextEdit::PTextEdit( QWidget *parent )
bool gotTheme = getTheme();
// reads and manages the conents of the xml-startup (musredit_startup.xml) file
fAdmin = new PAdmin();
fAdmin = std::make_unique<PAdmin>();
// set default setting of the fDarkMenuIconIcons only if a theme has been recognized, otherwise take the
// one from the xml startup file.
@@ -166,10 +166,6 @@ PTextEdit::PTextEdit( QWidget *parent )
*/
void PTextEdit::aboutToQuit()
{
if (fAdmin) {
delete fAdmin;
fAdmin = nullptr;
}
if (fMusrT0Action) {
delete fMusrT0Action;
fMusrT0Action = nullptr;
@@ -983,7 +979,7 @@ void PTextEdit::load( const QString &f, const int index )
return;
// create a new text edit object
PSubTextEdit *edit = new PSubTextEdit( fAdmin );
PSubTextEdit *edit = new PSubTextEdit( fAdmin.get() );
edit->setFont(QFont(fAdmin->getFontName(), fAdmin->getFontSize()));
// place the text edit object at the appropriate tab position
@@ -1167,7 +1163,7 @@ void PTextEdit::insertStatisticBlock()
*/
void PTextEdit::fileNew()
{
PSubTextEdit *edit = new PSubTextEdit( fAdmin );
PSubTextEdit *edit = new PSubTextEdit( fAdmin.get() );
edit->setFont(QFont(fAdmin->getFontName(), fAdmin->getFontSize()));
doConnections( edit );
fTabWidget->addTab( edit, tr( "noname" ) );
@@ -2703,7 +2699,7 @@ void PTextEdit::musrFT()
*/
void PTextEdit::musrPrefs()
{
PPrefsDialog *dlg = new PPrefsDialog(fAdmin);
PPrefsDialog *dlg = new PPrefsDialog(fAdmin.get());
if (dlg == nullptr) {
QMessageBox::critical(this, "ERROR musrPrefs", "Couldn't invoke Preferences Dialog.");