[Ace-users] [ace-users] [ace-bugs] A problem with copying ACE_Handler
Douglas C. Schmidt
schmidt at dre.vanderbilt.edu
Thu Nov 8 09:38:06 CST 2007
Thanks for using the PRF.
> 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
> A problem with copying ACE_Handler.
> 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.
I don't think we anticipated this use-case when the class was written.
If you'd like to send us patches that fix this that would be super!
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Vanderbilt University WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203 NET: d.schmidt at vanderbilt.edu
More information about the Ace-users