From 00d0a0eae3a3a4cf8dcd412099a3091340677fc7 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Mon, 15 Apr 2013 20:54:31 -0400 Subject: [PATCH] Fix reference count problem as suggested by Ingo. During DefaultNotificationService's constructor, we get registered with the NotificationManager, which acquires a reference. When uninitializing the module we need to release this reference before calling the destructor in order to balance the books, as it were. --- src/add-ons/kernel/network/notifications/notifications.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/add-ons/kernel/network/notifications/notifications.cpp b/src/add-ons/kernel/network/notifications/notifications.cpp index 565d4cb233..519554546b 100644 --- a/src/add-ons/kernel/network/notifications/notifications.cpp +++ b/src/add-ons/kernel/network/notifications/notifications.cpp @@ -43,8 +43,6 @@ NetNotificationService::NetNotificationService() : DefaultUserNotificationService("network") { - // We need to set the reference count to zero for DEBUG builds - fReferenceCount = 0; } @@ -145,6 +143,9 @@ notifications_std_ops(int32 op, ...) unregister_generic_syscall(NET_NOTIFICATIONS_SYSCALLS, 1); + // we need to release the reference that was acquired + // on our behalf by the NotificationManager. + sNotificationService.ReleaseReference(); sNotificationService.~NetNotificationService(); return B_OK;