build on 10.4

This commit is contained in:
David Rose 2009-12-22 22:20:26 +00:00
parent 708d5e37fb
commit db637e7f83
2 changed files with 13 additions and 7 deletions

View File

@ -85,6 +85,11 @@ PPInstance(NPMIMEType pluginType, NPP instance, uint16_t mode,
_python_window_open = false;
#ifdef __APPLE__
// Get the run loop in the browser thread. (CFRunLoopGetMain() is
// only 10.5 or higher. Plus, the browser thread is not necessarily
// the "main" thread.)
_run_loop_main = CFRunLoopGetCurrent();
CFRetain(_run_loop_main);
_request_timer = NULL;
#endif // __APPLE__
}
@ -99,11 +104,12 @@ PPInstance::
cleanup_window();
#ifdef __APPLE__
if (_request_timer != NULL) {
CFRunLoopTimerInvalidate(_request_timer);
CFRelease(_request_timer);
_request_timer = NULL;
}
if (_request_timer != NULL) {
CFRunLoopTimerInvalidate(_request_timer);
CFRelease(_request_timer);
}
_run_loop_main = CFRunLoopGetCurrent();
CFRelease(_run_loop_main);
#endif // __APPLE__
if (_p3d_inst != NULL) {
@ -1032,8 +1038,7 @@ request_ready(P3D_instance *instance) {
timer_context.info = inst;
inst->_request_timer = CFRunLoopTimerCreate
(NULL, 0, 0, 0, 0, timer_callback, &timer_context);
CFRunLoopRef run_loop = CFRunLoopGetMain();
CFRunLoopAddTimer(run_loop, inst->_request_timer, kCFRunLoopCommonModes);
CFRunLoopAddTimer(inst->_run_loop_main, inst->_request_timer, kCFRunLoopCommonModes);
#endif // __APPLE__
// Doesn't appear to be a reliable way to simulate this in Linux.

View File

@ -187,6 +187,7 @@ private:
#endif // _WIN32
#ifdef __APPLE__
CFRunLoopRef _run_loop_main;
CFRunLoopTimerRef _request_timer;
#endif // __APPLE__