Google
  Web www.spinics.net

Re: [Openh323-devel] Serious API change in PTrace::SetStream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi Andriy,

I've been bitten by this change, too. You have to detect the PWLib
version and put and #ifdef around the delete.

This is the code GnuGk uses:

// define hasDeletingSetStream for PWLib >= 1.11.2
#if PWLIB_MAJOR == 1
  #if PWLIB_MINOR >= 11
    #if PWLIB_BUILD >= 2
       #define hasDeletingSetStream 1
    #endif
  #endif
#endif

...

#ifndef hasDeletingSetStream
delete logstream
#endif


Regards,
Jan


Andriy Pylypenko wrote:
> Hi,
> 
> I'm using an Asterisk with chan_h323 module which is based on openh323. 
> After upgrading to pwlib 1.12 I started to experience crashes during 
> loading and unloading that module. The problem isn't stopper but is 
> quite annoying so I've made an investigation and found out that the 
> crash occurs in the following code:
> 
>           if (logstream) {
>                 PTrace::SetLevel(0);
>                 PTrace::SetStream(&cout);
>                 delete logstream; // APPLICATION CRASHES HERE
>                 logstream = NULL;
>         }
> 
> And here is the code from PTraceInfo::SetStream:
> 
>         void SetStream(ostream * newStream)
>         {
>         [skip]
>             if (stream != &cerr && stream != &cout)
>                 delete stream;
>             stream = newStream;
> 
> However the pwlib prior 1.12.0 didn't delete the old stream:
> 
>         void PTrace::SetStream(ostream * s)
>         {
>         #ifndef __NUCLEUS_PLUS__
>           if (s == NULL)
>             s = &cerr;
>         #endif
> 
>           if (PTraceMutex == NULL)
>             PTraceStream = s;
>           else {
>             PWaitAndSignal m(*PTraceMutex);
>             PTraceStream = s;
>           }
>         }
> 
> IMHO this API change is too serious to be allowed without any 
> compatibility shims.
> 
> -- 
>   Kind regards,
>   Andriy Pylypenko

-- 
Jan Willamowius, jan@xxxxxxxxxxxxxx, http://www.gnugk.org/

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Openh323-devel mailing list
Openh323-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/openh323-devel

[Open H.323]     [IETF SIP]     [Gnu Gatekeeper]     [Asterisk PBX]     [Fedora Linux]     [Gimp]     [Yosemite News]     [Yosemite Photos]     [Yosemite Campsites]     [ISDN Cause Codes]

Add to Google Powered by Linux