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 680529 - wrong reference count in g_async_queue_unref calls on exit
wrong reference count in g_async_queue_unref calls on exit
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
3.4.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-07-24 14:27 UTC by sangkil.cha
Modified: 2012-08-01 22:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ephy-history-service: prevent double call to execute_quit() (972 bytes, patch)
2012-08-01 07:25 UTC, Claudio Saavedra
committed Details | Review

Description sangkil.cha 2012-07-24 14:27:11 UTC
The ephy_history_service_execute_quit function is called twice when the browser is closed by user. First call is made from "ephy_history_service_process_message" when exit message is catched, "ephy_history_service_execute_quit" will be called.

Second call is made from the "run_history_service_thread" function where there is a function call to "ephy_history_service_execute_quit" after a do-while message loop.

In both cases "ephy_history_service_execute_quit" is called and in the end, "g_async_queue_unref" will be called for the same object.

Because of the wrong reference count, reference object in the queue is already freed, and it leads to an invalid access to the freed object.

In most of the case, this is not a problem, because it will not lead to a program crash or anything. In my case, I was using different memory allocator than regular glibc allocator, and that was the reason why I could catch this bug.
Comment 1 Claudio Saavedra 2012-08-01 07:25:20 UTC
Created attachment 220037 [details] [review]
ephy-history-service: prevent double call to execute_quit()

execute_quit() is called already when the QUIT message is received,
there is no need to call it after the thread loop quits.
Comment 2 Claudio Saavedra 2012-08-01 07:27:32 UTC
Slightly related, I noticed that anyone leaking a reference to the global EphyShell will prevent the service to be shutdown correctly (which might lead to pending database commits not happening), so we probably need an explicit shutdown method to call on app quit.
Comment 3 Xan Lopez 2012-08-01 17:39:28 UTC
Review of attachment 220037 [details] [review]:

Make it so.
Comment 4 Claudio Saavedra 2012-08-01 22:14:22 UTC
Attachment 220037 [details] pushed as bf64be0 - ephy-history-service: prevent double call to execute_quit()