Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rare panic during ApplePS2Controller initialization #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
43 changes: 22 additions & 21 deletions VoodooPS2Controller/VoodooPS2Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -526,27 +526,6 @@ bool ApplePS2Controller::start(IOService * provider)
#else
setProperty("RM,Build", "Release-" LOGNAME);
#endif

OSDictionary * propertyMatch = propertyMatching(OSSymbol::withCString(kDeliverNotifications), OSBoolean::withBoolean(true));

IOServiceMatchingNotificationHandler notificationHandler = OSMemberFunctionCast(IOServiceMatchingNotificationHandler, this, &ApplePS2Controller::notificationHandler);

//
// Register notifications for availability of any IOService objects wanting to consume our message events
//
_publishNotify = addMatchingNotification(gIOFirstPublishNotification,
propertyMatch,
notificationHandler,
this,
0, 10000);

_terminateNotify = addMatchingNotification(gIOTerminatedNotification,
propertyMatch,
notificationHandler,
this,
0, 10000);

propertyMatch->release();

//
// The driver has been instructed to start. Allocate all our resources.
Expand Down Expand Up @@ -664,6 +643,28 @@ bool ApplePS2Controller::start(IOService * provider)

provider->joinPMtree(this);

//
// Register notifications for availability of any IOService objects wanting to consume our message events
//
{
OSDictionary * propertyMatch = propertyMatching(OSSymbol::withCString(kDeliverNotifications), OSBoolean::withBoolean(true));
IOServiceMatchingNotificationHandler notificationHandler = OSMemberFunctionCast(IOServiceMatchingNotificationHandler, this, &ApplePS2Controller::notificationHandler);

_publishNotify = addMatchingNotification(gIOFirstPublishNotification,
propertyMatch,
notificationHandler,
this,
0, 10000);

_terminateNotify = addMatchingNotification(gIOTerminatedNotification,
propertyMatch,
notificationHandler,
this,
0, 10000);

OSSafeReleaseNULL(propertyMatch);
}

//
// Create the keyboard nub and the mouse nub. The keyboard and mouse drivers
// will query these nubs to determine the existence of the keyboard or mouse,
Expand Down