Skip to content

Commit

Permalink
Revert parented_ptr for TrackCollectionManager in main window
Browse files Browse the repository at this point in the history
Manual deletion is required to enforce the correct order of destruction.
This commit also fixes a double free bug caused by introducing
parented_ptr.
  • Loading branch information
uklotzde committed Nov 25, 2019
1 parent 44596b6 commit 69faf56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/mixxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ void MixxxMainWindow::initialize(QApplication* pApp, const CmdlineArgs& args) {

launchProgress(30);

m_pTrackCollectionManager = make_parented<TrackCollectionManager>(
m_pTrackCollectionManager = new TrackCollectionManager(
this,
pConfig,
m_pDbConnectionPool);
Expand Down
3 changes: 1 addition & 2 deletions src/mixxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "util/cmdlineargs.h"
#include "util/timer.h"
#include "util/db/dbconnectionpool.h"
#include "util/parented_ptr.h"
#include "soundio/sounddeviceerror.h"

class ChannelHandleFactory;
Expand Down Expand Up @@ -178,7 +177,7 @@ class MixxxMainWindow : public QMainWindow {
// The Mixxx database connection pool
mixxx::DbConnectionPoolPtr m_pDbConnectionPool;

parented_ptr<TrackCollectionManager> m_pTrackCollectionManager;
TrackCollectionManager* m_pTrackCollectionManager;

// The library management object
Library* m_pLibrary;
Expand Down

1 comment on commit 69faf56

@daschuer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parented_ptr only documents a mechanism they is there anyway.
So this commit does not change any machine code.
If you delete a patented_ptr manually nothing bad happen, except the performance penalty of removing the deleted object from it's parent.
I guess we need to splitt the destructor her do de coupple clean up from deleting the object.

Please sign in to comment.