Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Source/CFRunLoop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1587,6 +1587,7 @@ CFRunLoopObserverCreate (CFAllocatorRef alloc, CFOptionFlags activities,
if (new)
{
GSMutexInitialize (&(new->_lock));
new->_isValid = true;
new->_activities = activities;
new->_repeats = repeats;
new->_order = order;
Expand Down
22 changes: 22 additions & 0 deletions Tests/CFRunLoop/observer_valid.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include "CoreFoundation/CFRunLoop.h"
#include "../CFTesting.h"

static void
observe (CFRunLoopObserverRef o, CFRunLoopActivity a, void *info)
{
}

int main (void)
{
CFRunLoopObserverRef obs = CFRunLoopObserverCreate (NULL,
kCFRunLoopBeforeWaiting, false, 0, observe, NULL);

PASS_CF (CFRunLoopObserverIsValid (obs) == true, "A new observer is valid.");

CFRunLoopObserverInvalidate (obs);
PASS_CF (CFRunLoopObserverIsValid (obs) == false,
"An invalidated observer is no longer valid.");

CFRelease (obs);
return 0;
}
Loading