cdvdgigaherz: Use unique_ptr for src

This commit is contained in:
Jonathan Li 2016-10-26 10:37:28 +01:00
parent f8f79788e4
commit d872c0560a
2 changed files with 5 additions and 5 deletions

View File

@ -123,7 +123,7 @@ std::atomic<bool> s_keepalive_is_open;
bool disc_has_changed = false;
bool weAreInNewDiskCB = false;
IOCtlSrc *src;
std::unique_ptr<IOCtlSrc> src;
char throwaway[2352];
extern s32 prefetch_last_lba;
@ -203,7 +203,7 @@ s32 CALLBACK CDVDopen(const char *pTitleFilename)
// open device file
try {
src = new IOCtlSrc(drive);
src = std::unique_ptr<IOCtlSrc>(new IOCtlSrc(drive));
} catch (std::runtime_error &ex) {
fputs(ex.what(), stdout);
return -1;
@ -221,8 +221,7 @@ void CALLBACK CDVDclose()
StopKeepAliveThread();
cdvdStopThread();
//close device
delete src;
src = NULL;
src.reset();
}
void CALLBACK CDVDshutdown()

View File

@ -22,6 +22,7 @@
#include <cstdio>
#include <cstring>
#include <memory>
#include <mutex>
#include <string>
#include <vector>
@ -83,7 +84,7 @@ public:
bool DiscReady();
};
extern IOCtlSrc *src;
extern std::unique_ptr<IOCtlSrc> src;
void configure();