Skip to content
Browse files

return ADDON_STATUS_PERMANENT_FAILURE when a call to RegisterMe() fai…

…ls in ADDON_Create()
  • Loading branch information...
1 parent e425e9f commit b908d345c2b918906c2756f3e4d0a9ed11ddb241 @opdenkamp committed
View
12 addons/pvr.demo/src/client.cpp
@@ -22,6 +22,7 @@
#include "client.h"
#include "xbmc_pvr_dll.h"
#include "PVRDemoData.h"
+#include "platform/util/util.h"
using namespace std;
using namespace ADDON;
@@ -62,11 +63,18 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
XBMC = new CHelper_libXBMC_addon;
if (!XBMC->RegisterMe(hdl))
- return ADDON_STATUS_UNKNOWN;
+ {
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
+ }
PVR = new CHelper_libXBMC_pvr;
if (!PVR->RegisterMe(hdl))
- return ADDON_STATUS_UNKNOWN;
+ {
+ SAFE_DELETE(PVR);
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
+ }
XBMC->Log(LOG_DEBUG, "%s - Creating the PVR demo add-on", __FUNCTION__);
View
4 addons/pvr.fortherecord.argus/src/client.cpp
@@ -73,7 +73,7 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
if (!XBMC->RegisterMe(hdl))
{
SAFE_DELETE(XBMC);
- return ADDON_STATUS_UNKNOWN;
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
PVR = new CHelper_libXBMC_pvr;
@@ -81,7 +81,7 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
{
SAFE_DELETE(PVR);
SAFE_DELETE(XBMC);
- return ADDON_STATUS_UNKNOWN;
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
#ifdef TSREADER
View
14 addons/pvr.hts/src/client.cpp
@@ -25,6 +25,7 @@
#include "HTSPDemux.h"
#include "platform/threads/mutex.h"
#include "platform/util/atomic.h"
+#include "platform/util/util.h"
using namespace std;
using namespace ADDON;
@@ -128,19 +129,16 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
XBMC = new CHelper_libXBMC_addon;
if (!XBMC->RegisterMe(hdl))
{
- delete XBMC;
- XBMC = NULL;
- return ADDON_STATUS_UNKNOWN;
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
PVR = new CHelper_libXBMC_pvr;
if (!PVR->RegisterMe(hdl))
{
- delete PVR;
- delete XBMC;
- PVR = NULL;
- XBMC = NULL;
- return ADDON_STATUS_UNKNOWN;
+ SAFE_DELETE(PVR);
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
XBMC->Log(LOG_DEBUG, "%s - Creating Tvheadend PVR-Client", __FUNCTION__);
View
4 addons/pvr.mediaportal.tvserver/src/client.cpp
@@ -78,7 +78,7 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
if (!XBMC->RegisterMe(hdl))
{
SAFE_DELETE(XBMC);
- return ADDON_STATUS_UNKNOWN;
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
PVR = new CHelper_libXBMC_pvr;
@@ -86,7 +86,7 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
{
SAFE_DELETE(PVR);
SAFE_DELETE(XBMC);
- return ADDON_STATUS_UNKNOWN;
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
XBMC->Log(LOG_INFO, "Creating MediaPortal PVR-Client");
View
4 addons/pvr.nextpvr/src/client.cpp
@@ -66,7 +66,7 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
if (!XBMC->RegisterMe(hdl))
{
SAFE_DELETE(XBMC);
- return ADDON_STATUS_UNKNOWN;
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
PVR = new CHelper_libXBMC_pvr;
@@ -74,7 +74,7 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
{
SAFE_DELETE(PVR);
SAFE_DELETE(XBMC);
- return ADDON_STATUS_UNKNOWN;
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
XBMC->Log(LOG_INFO, "Creating NextPVR PVR-Client");
View
13 addons/pvr.njoy/src/client.cpp
@@ -22,7 +22,7 @@
#include "client.h"
#include "xbmc_pvr_dll.h"
#include "N7Xml.h"
-
+#include "platform/util/util.h"
using namespace std;
using namespace ADDON;
@@ -73,11 +73,18 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
XBMC = new CHelper_libXBMC_addon;
if (!XBMC->RegisterMe(hdl))
- return ADDON_STATUS_UNKNOWN;
+ {
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
+ }
PVR = new CHelper_libXBMC_pvr;
if (!PVR->RegisterMe(hdl))
- return ADDON_STATUS_UNKNOWN;
+ {
+ SAFE_DELETE(PVR);
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
+ }
XBMC->Log(LOG_DEBUG, "Creating N7 PVR-Client");
m_CurStatus = ADDON_STATUS_UNKNOWN;
View
21 addons/pvr.vdr.vnsi/src/client.cpp
@@ -25,6 +25,7 @@
#include "VNSIRecording.h"
#include "VNSIData.h"
#include "VNSIChannelScan.h"
+#include "platform/util/util.h"
#include <sstream>
#include <string>
@@ -70,23 +71,25 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
XBMC = new CHelper_libXBMC_addon;
if (!XBMC->RegisterMe(hdl))
{
- delete XBMC;
- XBMC = NULL;
- return ADDON_STATUS_UNKNOWN;
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
GUI = new CHelper_libXBMC_gui;
if (!GUI->RegisterMe(hdl))
- return ADDON_STATUS_UNKNOWN;
+ {
+ SAFE_DELETE(GUI);
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
+ }
PVR = new CHelper_libXBMC_pvr;
if (!PVR->RegisterMe(hdl))
{
- delete PVR;
- delete XBMC;
- PVR = NULL;
- XBMC = NULL;
- return ADDON_STATUS_UNKNOWN;
+ SAFE_DELETE(PVR);
+ SAFE_DELETE(GUI);
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
XBMC->Log(LOG_DEBUG, "Creating VDR VNSI PVR-Client");
View
14 addons/pvr.vuplus/src/client.cpp
@@ -23,6 +23,7 @@
#include "xbmc_pvr_dll.h"
#include <stdlib.h>
#include "VuData.h"
+#include "platform/util/util.h"
using namespace std;
using namespace ADDON;
@@ -166,19 +167,16 @@ ADDON_STATUS ADDON_Create(void* hdl, void* props)
XBMC = new CHelper_libXBMC_addon;
if (!XBMC->RegisterMe(hdl))
{
- delete XBMC;
- XBMC = NULL;
- return ADDON_STATUS_UNKNOWN;
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
PVR = new CHelper_libXBMC_pvr;
if (!PVR->RegisterMe(hdl))
{
- delete PVR;
- delete XBMC;
- PVR = NULL;
- XBMC = NULL;
- return ADDON_STATUS_UNKNOWN;
+ SAFE_DELETE(PVR);
+ SAFE_DELETE(XBMC);
+ return ADDON_STATUS_PERMANENT_FAILURE;
}
XBMC->Log(LOG_DEBUG, "%s - Creating VU+ PVR-Client", __FUNCTION__);
View
27 lib/platform/util/util.h
@@ -0,0 +1,27 @@
+#pragma once
+/*
+ * Copyright (C) 2012 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef SAFE_DELETE
+#define SAFE_DELETE(p) do { delete (p); (p)=NULL; } while (0)
+#endif
+#ifndef SAFE_DELETE_ARRAY
+#define SAFE_DELETE_ARRAY(p) do { delete[] (p); (p)=NULL; } while (0)
+#endif

0 comments on commit b908d34

Please sign in to comment.
Something went wrong with that request. Please try again.