[Ace-users] [ace-bugs] A problem with copying ACE_Handler

Juraj Ivančić juraj.ivancic at gmail.com
Thu Nov 8 03:52:01 CST 2007


    ACE VERSION: 5.6.1

    HOST MACHINE and OPERATING SYSTEM:
         Intel Pentium, WinXP, Winsock2

    COMPILER NAME AND VERSION (AND PATCHLEVEL):
    MS VS 7.1

    THE $ACE_ROOT/ace/config.h FILE: config-win32.h

    CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/default.features
    (used by MPC when you generate your own makefiles):

    DOES THE PROBLEM AFFECT:
        COMPILATION? No
        LINKING? No
        EXECUTION? Yes

    SYNOPSIS:
    A problem with copying ACE_Handler.

    DESCRIPTION:
    A copy of ACE_Handler object will have an invalid ACE_Handler::Proxy 
member. I.e. a copy of the ACE_Handler will
   receive a copy of the original object's proxy shared pointer. This 
has two potential problems:
       1. ACE_Handler should, as far as I can understand, always contain 
a proxy which points to itself, not some other handler.
       2. When either of the two is destroyed (original or the copy) it 
will reset (shared) proxy's pointer, and we are left with an
           ACE_Handler with an invalid proxy_ member.

    E.g. (the one that lead me to this bug)  if you try to create 
ACE_Handler factory method which returns an ACE_Handler by value.

    ACE_Handler factory()
    {
       return ACE_Handler();
    }

    In this case, the returned ACE_Handler has proxy_ which points to 
nothing. As a consequence, no notifications from the proactor
will reach this handler.

    SAMPLE FIX/WORKAROUND:
    Recheck destructor / copy-constructor / assignment operator.



More information about the Ace-users mailing list