[Issue 4092] broken memory management for COM objects derived from IUnknown

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 27 07:10:34 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=4092


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-09-27 07:10:31 PDT ---
(In reply to comment #5)
>     new(uint size)

Should likely be size_t.

>         LONG lRef = InterlockedIncrement(&count);
>         LONG lRef = InterlockedDecrement(&count);

Can a a synchronized block be used instead? These functions are declared in
core.sys.win*, but they're commented out in dsource's WinAPI, with these
comments:

-----
/+
//--------------------------------------
// These functions are problematic

version(UseNtoSKernel) {}else {
    /* CAREFUL: These are exported from ntoskrnl.exe and declared in winddk.h
       as __fastcall functions, but are  exported from kernel32.dll as
__stdcall */
    static if (_WIN32_WINNT >= 0x0501) {
     VOID InitializeSListHead(PSLIST_HEADER);
    }
    LONG InterlockedCompareExchange(LPLONG, LONG, LONG);
    // PVOID WINAPI InterlockedCompareExchangePointer(PVOID*, PVOID, PVOID);
    (PVOID)InterlockedCompareExchange((LPLONG)(d)   
(PVOID)InterlockedCompareExchange((LPLONG)(d), (LONG)(e), (LONG)(c))
    LONG InterlockedDecrement(LPLONG);
    LONG InterlockedExchange(LPLONG, LONG);
    // PVOID WINAPI InterlockedExchangePointer(PVOID*, PVOID);
    (PVOID)InterlockedExchange((LPLONG)((PVOID)InterlockedExchange((LPLONG)(t),
(LONG)(v))
    LONG InterlockedExchangeAdd(LPLONG, LONG);

    static if (_WIN32_WINNT >= 0x0501) {
    PSLIST_ENTRY InterlockedFlushSList(PSLIST_HEADER);
    }
    LONG InterlockedIncrement(LPLONG);
    static if (_WIN32_WINNT >= 0x0501) {
    PSLIST_ENTRY InterlockedPopEntrySList(PSLIST_HEADER);
    PSLIST_ENTRY InterlockedPushEntrySList(PSLIST_HEADER, PSLIST_ENTRY);
    }
} // #endif //  __USE_NTOSKRNL__
//--------------------------------------
+/
-----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list