After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786666 - controller: free notebook with g_object_unref
controller: free notebook with g_object_unref
Status: RESOLVED FIXED
Product: bijiben
Classification: Applications
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: Bijiben maintainer(s)
Bijiben maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-08-23 05:04 UTC by Mohammed Sadiq
Modified: 2017-08-28 03:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
controller: free notebook with g_object_unref (838 bytes, patch)
2017-08-23 05:04 UTC, Mohammed Sadiq
none Details | Review
controller: free notebook with g_clear_object (821 bytes, patch)
2017-08-23 13:03 UTC, Mohammed Sadiq
committed Details | Review

Description Mohammed Sadiq 2017-08-23 05:04:32 UTC
This was causing a (possible unnoticed) segfault.

How to reproduce:
1. Create a notebook in bijiben.
2. Open the notebook.
3. Close bijiben

Result:

=================================================================
==21028==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x61d000126210 in thread T0
    #0 0x7f92caec0a10 in free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1a10)
    #1 0x7f92c26215a6 in g_free /home/sadiq/jhbuild/checkout/glib/glib/gmem.c:189
    #2 0x55e2dd99cee5 in bjb_controller_finalize /home/sadiq/jhbuild/checkout/bijiben/src/bjb-controller.c:140
    #3 0x7f92c394c6da in g_object_unref /home/sadiq/jhbuild/checkout/glib/gobject/gobject.c:3314
    #4 0x55e2dd9c33f8 in bjb_window_base_finalize /home/sadiq/jhbuild/checkout/bijiben/src/bjb-window-base.c:74
    #5 0x7f92c394c6da in g_object_unref /home/sadiq/jhbuild/checkout/glib/gobject/gobject.c:3314
    #6 0x7f92c55501d4 in gtk_main_do_event /home/sadiq/jhbuild/checkout/gtk+-3/gtk/gtkmain.c:1815
    #7 0x7f92c56d8dff in send_delete_event /home/sadiq/jhbuild/checkout/gtk+-3/gtk/gtkwindow.c:1322
    #8 0x7f92c501df47 in gdk_threads_dispatch /home/sadiq/jhbuild/checkout/gtk+-3/gdk/gdk.c:743
    #9 0x7f92c261895c in g_idle_dispatch /home/sadiq/jhbuild/checkout/glib/glib/gmain.c:5504
    #10 0x7f92c26196a7 in g_main_dispatch /home/sadiq/jhbuild/checkout/glib/glib/gmain.c:3148
    #11 0x7f92c261bef1 in g_main_context_dispatch /home/sadiq/jhbuild/checkout/glib/glib/gmain.c:3813
    #12 0x7f92c261c056 in g_main_context_iterate /home/sadiq/jhbuild/checkout/glib/glib/gmain.c:3886
    #13 0x7f92c261c0d4 in g_main_context_iteration /home/sadiq/jhbuild/checkout/glib/glib/gmain.c:3947
    #14 0x7f92c3c36820 in g_application_run /home/sadiq/jhbuild/checkout/glib/gio/gapplication.c:2401
    #15 0x55e2dd9a7d36 in main /home/sadiq/jhbuild/checkout/bijiben/src/bjb-main.c:37
    #16 0x7f92c153b2b0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202b0)
    #17 0x55e2dd996cd9 in _start (/media/sadiq/Temp/jhbuild/install/bin/bijiben+0xd9cd9)

0x61d000126210 is located 528 bytes inside of 1008-byte region [0x61d000126000,0x61d0001263f0)
allocated by thread T5 (pool) here:
    #0 0x7f92caec1760 in posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc2760)
    #1 0x7f92c2637e72 in allocator_memalign /home/sadiq/jhbuild/checkout/glib/glib/gslice.c:1411

Thread T5 (pool) created by T0 here:
    #0 0x7f92cae2ff59 in __interceptor_pthread_create (/usr/lib/x86_64-linux-gnu/libasan.so.3+0x30f59)
    #1 0x7f92c26617c9 in g_system_thread_new /home/sadiq/jhbuild/checkout/glib/glib/gthread-posix.c:1170

SUMMARY: AddressSanitizer: bad-free (/usr/lib/x86_64-linux-gnu/libasan.so.3+0xc1a10) in free
==21028==ABORTING
Comment 1 Mohammed Sadiq 2017-08-23 05:04:39 UTC
Created attachment 358200 [details] [review]
controller: free notebook with g_object_unref

notebook is derived from GObject. So free the right way.
Comment 2 Jonathan Kang 2017-08-23 07:17:53 UTC
Review of attachment 358200 [details] [review]:

Looks good to me.
Comment 3 Mohammed Sadiq 2017-08-23 13:03:54 UTC
Created attachment 358231 [details] [review]
controller: free notebook with g_clear_object

notebook is derived from GObject. So free the right way.
Comment 4 Isaque Galdino 2017-08-28 03:18:44 UTC
Review of attachment 358231 [details] [review]:

Looks good to me too.
Comment 5 Isaque Galdino 2017-08-28 03:20:02 UTC
Thanks for your patch.