]> granicus.if.org Git - handbrake/commitdiff
libhb: initialize sleep prevention reasonForActivity CFStringRef inside a function...
authorDamiano Galassi <damiog@gmail.com>
Wed, 15 Mar 2017 17:10:02 +0000 (18:10 +0100)
committerDamiano Galassi <damiog@gmail.com>
Wed, 15 Mar 2017 17:10:02 +0000 (18:10 +0100)
libhb/ports.c

index afc5c59c90b4d3eda5adf609a4be18787dc7ac92..a483ed9bc673acd56b808e2a2ae9781591f605bc 100644 (file)
@@ -1267,12 +1267,6 @@ void hb_net_close( hb_net_t ** _n )
 * OS Sleep Allow / Prevent
 ***********************************************************************/
 
-#ifdef __APPLE__
-// 128 chars limit for IOPMAssertionCreateWithName
-static CFStringRef reasonForActivity =
-    CFSTR("HandBrake is currently scanning and/or encoding");
-#endif
-
 void* hb_system_sleep_opaque_init()
 {
     void *opaque = NULL;
@@ -1351,6 +1345,10 @@ void hb_system_sleep_private_disable(void *opaque)
         return;
     }
 
+    // 128 chars limit for IOPMAssertionCreateWithName
+    CFStringRef reasonForActivity =
+    CFSTR("HandBrake is currently scanning and/or encoding");
+
     IOReturn success = IOPMAssertionCreateWithName(kIOPMAssertPreventUserIdleSystemSleep,
                                                    kIOPMAssertionLevelOn,
                                                    reasonForActivity,