Hello,

I did some investigations regarding the reference counts at con- and
destruction and drew a chart (see attached constr_destr_chart.txt). As
you can see there, at destruction time there is no equvalent call to
gdk_directfb_event_windows_add().
Adding a gdk_directfb_event_windows_remove() function and callig it in
_gdk_windowing_window_destroy() (patch is attached) seems to fix it (I
think), or was such a function (and its call) omitted on purpose?

Regards

Simon Lanzmich
---- Construction: ----

gdk_directfb_window_new:
|   create_directfb_window:
|   |---IDirectFBDisplayLayer_CreateWindow:
|   |   \-- dfb_layer_context_create_window:
|   |   |   \-- dfb_window_create:
|   |   |   |-- dfb_core_create_window: --------- new CoreWindow,         a 1
|   |   |   \-- dfb_surface_create: ------------- new CoreSurface,        b 1
|   |   \-- IDirectFBWindow_Construct:----------- new IDirectFBWindow,    c 1
|   |
|   \---IDirectFBWindow_GetSurface:
|       \-- IDirectFBSurface_Window_Construct:
|       |   |------ IDirectFBSurface_Construct:
|       |   |   |-------------------------------- new IDirectFBSurface,   d 1
|       |   |   |-------------------------------- refs CoreSurface,       b 2
|       |   |   \-- dfb_state_set_destination:
|       |   |       \---------------------------- refs CoreSurface,       b 3
|       |   \------------------------------------ refs CoreWindow,        a 2
|       \-- IDirectFBSurface_AddRef:
|           \------------------------------------ refs IDirectFBSurface,  d 2
|
\-- gdk_directfb_event_windows_add:
    \-- IDirectFBWindow_AttachEventBuffer:
        \-- IDirectFBEventBuffer_AttachWindow:
            \------------------------------------ refs CoreWindow,        a 3

-- summary: --
a CoreWindow,           3 refs
a CoreSurface,          3 refs
an IDirectFBWindow,     1 ref
an IDirectFBSurface,    2 refs



---- Destruction: ----

At the beginning, there are these values:
IDirectFBWindow,        1 refs
IDirectFBSurface,       1 ref
CoreWindow,             3 refs
CoreSurface,            3 refs

_gdk_windowing_window_destroy:
|-- << PROPOSED FIX: call gdk_directfb_event_windows_remove() >>
\-- IDirectFBWindow_Release:
    \---+---------------------------------------------- unrefs IDirectFBWindow, 
    d 0
        IDirectFBWindow_Destruct:
        |---------------------------------------------- unrefs CoreWindow,      
    a 2
        |-- IDirectFBSurface_Window_Release:
        |   \---+-------------------------------------- unrefs 
IDirectFBSurface,    c 0
        |       IDirectFBSurface_Window_Destruct ------ unrefs CoreWindow,      
    a 1
        |       \-- IDirectFBSurface_Destruct:
        |           |-- dfb_state_set_destination: ---- unrefs CoreSurface,     
    b 2
        |           |-- dfb_surface_unref: ------------ unrefs Coresurface,     
    b 1
        |           \-- DIRECT_DEALLOCATE_INTERFACE: -- destroys 
IDirectFBSurface,  c _dead_
        \-- DIRECT_DEALLOCATE_INTERFACE: -------------- destroys 
IDirectFBWindow,   d _dead_

-- summary: --
IDirectFBWindow,        destroyed
IDirectFBSurface,       destroyed
CoreWindow,             1 refs
CoreSurface,            1 refs

Attachment: proposed_memleak_fix.patch
Description: proposed_memleak_fix.patch

_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to