Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2009 from jimfcarroll/screensaver-crash-fix

Screensaver crash fix
  • Loading branch information...
commit 27781a947a244d6d34b651cd4897cd447f0295be 2 parents f868fc4 + 988e51b
@davilla davilla authored
View
2  xbmc/interfaces/legacy/Window.cpp
@@ -37,6 +37,8 @@ namespace XBMCAddon
{
namespace xbmcgui
{
+ XbmcThreads::ThreadLocal<ref> InterceptorBase::upcallTls;
+
/**
* Used in add/remove control. It only locks if it's given a
* non-NULL CCriticalSection. It's given a NULL CCriticalSection
View
3  xbmc/interfaces/legacy/WindowInterceptor.h
@@ -43,7 +43,8 @@ namespace XBMCAddon
{
protected:
AddonClass::Ref<Window> window;
- XbmcThreads::ThreadLocal<ref> upcallTls;
+ // This instance is in Window.cpp
+ static XbmcThreads::ThreadLocal<ref> upcallTls;
InterceptorBase() : window(NULL) { upcallTls.set(NULL); }
View
1  xbmc/interfaces/python/LanguageHook.h
@@ -28,7 +28,6 @@
#include <Python.h>
#include "interfaces/legacy/LanguageHook.h"
-#include "threads/ThreadLocal.h"
#include "threads/Event.h"
#include <set>
View
1  xbmc/interfaces/python/swig.h
@@ -27,7 +27,6 @@
#include "interfaces/legacy/Exception.h"
#include "interfaces/legacy/AddonClass.h"
#include "interfaces/legacy/Window.h"
-#include "threads/ThreadLocal.h"
namespace PythonBindings
{
View
19 xbmc/threads/platform/win/ThreadLocal.h
@@ -21,6 +21,7 @@
#pragma once
#include <windows.h>
+#include "commons/Exception.h"
namespace XbmcThreads
{
@@ -32,11 +33,23 @@ namespace XbmcThreads
{
DWORD key;
public:
- inline ThreadLocal() { key = TlsAlloc(); }
+ inline ThreadLocal()
+ {
+ if ((key = TlsAlloc()) == TLS_OUT_OF_INDEXES)
+ throw XbmcCommons::UncheckedException("Ran out of Windows TLS Indexes. Windows Error Code %d",(int)GetLastError());
+ }
- inline ~ThreadLocal() { TlsFree(key); }
+ inline ~ThreadLocal()
+ {
+ if (!TlsFree(key))
+ throw XbmcCommons::UncheckedException("Failed to free Tls %d, Windows Error Code %d",(int)key, (int)GetLastError());
+ }
- inline void set(T* val) { TlsSetValue(key,(LPVOID)val); }
+ inline void set(T* val)
+ {
+ if (!TlsSetValue(key,(LPVOID)val))
+ throw XbmcCommons::UncheckedException("Failed to set Tls %d, Windows Error Code %d",(int)key, (int)GetLastError());
+ }
inline T* get() { return (T*)TlsGetValue(key); }
};
Please sign in to comment.
Something went wrong with that request. Please try again.