Ticket #11934: 0003-ProcessController-and-VolumeControl-solve-BMessage-k.patch

File 0003-ProcessController-and-VolumeControl-solve-BMessage-k.patch, 1.5 KB (added by Barrett, 5 years ago)
  • src/apps/processcontroller/PCWorld.cpp

    From 14c0d2cf772969bf1cca813c0a5218d647bb9abf Mon Sep 17 00:00:00 2001
    From: Dario Casalinuovo <b.vitruvio@gmail.com>
    Date: Mon, 30 Mar 2015 00:00:12 +0200
    Subject: [PATCH 3/3] ProcessController and VolumeControl: solve BMessage kind
     of memory leak.
    
    ---
     src/apps/processcontroller/PCWorld.cpp | 7 +++----
     src/bin/desklink/VolumeControl.cpp     | 3 ++-
     2 files changed, 5 insertions(+), 5 deletions(-)
    
    diff --git a/src/apps/processcontroller/PCWorld.cpp b/src/apps/processcontroller/PCWorld.cpp
    index e54bd4a..140ef54 100644
    a b PCApplication::ReadyToRun()  
    118118    int32 count = list.CountItems();
    119119    if (count > 1) {
    120120        for (int32 i = 0; i < count - 1; i++) {
    121             BMessenger* otherme = new BMessenger(NULL, (addr_t)list.ItemAt(i));
    122             BMessage* message = new BMessage(B_QUIT_REQUESTED);
    123             otherme->SendMessage(message);
    124             delete otherme;
     121            BMessenger otherme(NULL, (addr_t)list.ItemAt(i));
     122            BMessage message(B_QUIT_REQUESTED);
     123            otherme.SendMessage(&message);
    125124        }
    126125    }
    127126}
  • src/bin/desklink/VolumeControl.cpp

    diff --git a/src/bin/desklink/VolumeControl.cpp b/src/bin/desklink/VolumeControl.cpp
    index 8983830..615cc5e 100644
    a b VolumeControl::VolumeControl(BMessage* archive)  
    7979
    8080    fMixerControl = new MixerControl(volumeWhich);
    8181
    82     archive->SendReply(new BMessage(B_QUIT_REQUESTED));
     82    BMessage msg(B_QUIT_REQUESTED);
     83    archive->SendReply(&msg);
    8384}
    8485
    8586