danomatika / ofxPd

(maintained) a Pure Data addon for OpenFrameworks using libpd
Other
202 stars 45 forks source link

ofxPd crashes on exit #24

Closed samubence closed 11 years ago

samubence commented 12 years ago

I'm using OF0071 on Windows7, Codeblocks-mingw Any app using ofxPd crashes on exit Error message in debug mode:

0 76F68C39 ntdll!RtlUpcaseUnicodeChar() (C:\Windows\system32\ntdll.dll:??)

1 00000000 0x0081d008 in _argv() (??:??)

2 00000000 0x0081d00c in mutex() (??:??)

3 00000000 0x00000000 in ??() (??:??)

adding this to the ofxPd source "solves" the problem: seems that calling _LOCK, _UNLOCK causes the error: seeking for the real solution...

void ofxPd::clear() {

#ifndef TARGET_WIN32
    _LOCK();

    if(inputBuffer != NULL) {
        delete[] inputBuffer;
        inputBuffer = NULL;
    }
    PdBase::clear();
    _UNLOCK();
#endif

    channels.clear();

    // add default global channel
    Channel c;
    channels.insert(make_pair(-1, c));
}
danomatika commented 11 years ago

That's weird. We need to clear things. I wonder if it's something to do with the buffer pointers. I'll check this out.

danomatika commented 11 years ago

It seems like the mutex locking was causing a deadlock, so I just disabled locking in ofxPd::clear on Windows. The buffers and PdBase are still cleared. ... hopefully this is not a fix that inly works on my machine and yours ...

samubence commented 11 years ago

Great, thanks for the affort creating this great addon. On Nov 7, 2012 11:23 PM, "Dan Wilcox" notifications@github.com wrote:

It seems like the mutex locking was causing a deadlock, so I just disabled locking in ofxPd::clear on Windows. The buffers and PdBase are still cleared. ... hopefully this is not a fix that inly works on my machine and yours ...

— Reply to this email directly or view it on GitHubhttps://github.com/danomatika/ofxPd/issues/24#issuecomment-10167828.