overlay scrollbars crash my program

Bug #908618 reported by mike morrison on 2011-12-25
This bug affects 1 person
Affects Status Importance Assigned to Milestone
overlay-scrollbar (Ubuntu)

Bug Description

my program calls gdk_window_invalidate_rect() from a thread. it uses gdk_threads_enter() and gdk_threads_leave().

the overlay scrollbar also calls gdk_window_invalidate_rect on my window from within a timer callback (change_state_cb). that callback is, although in the main loop, not in the main GTK+ lock.

i imagine this is causing a lot of the crashes suggested above in the "Do any of the following bugs describe the bug you're trying to report?" list.

i'll submit a patch.

mike morrison (mike-morrison) wrote :

this patch modifies change_state_cb() by wrapping the call to draw_pager() in gdk_threads_enter() and gdk_threads_leave()

description: updated

The attachment "add_lock" of this bug report has been identified as being a patch. The ubuntu-reviewers team has been subscribed to the bug report so that they can review the patch. In the event that this is in fact not a patch you can resolve this situation by removing the tag 'patch' from the bug report and editing the attachment so that it is not flagged as a patch. Additionally, if you are member of the ubuntu-reviewers team please also unsubscribe the team from this bug report.

[This is an automated message performed by a Launchpad user owned by Brian Murray. Please contact him regarding any issues with the action taken in this bug report.]

tags: added: patch
Andrea Cimitan (cimi) wrote :

sorry for my ignorance, but why it should not be in the main thread?

mike morrison (mike-morrison) wrote :

straight from the documentation.. http://developer.gnome.org/gdk/stable/gdk-Threads.html

"Idles, timeouts, and input functions from GLib, such as g_idle_add(), are executed outside of the main GTK+ lock. So, if you need to call GTK+ inside of such a callback, you must surround the callback with a gdk_threads_enter()/gdk_threads_leave() pair or use gdk_threads_add_idle_full() which does this for you. However, event dispatching from the mainloop is still executed within the main GTK+ lock, so callback functions connected to event signals like GtkWidget::button-press-event, do not need thread protection.

In particular, this means, if you are writing widgets that might be used in threaded programs, you must surround timeouts and idle functions in this matter."

Changed in overlay-scrollbar (Ubuntu):
assignee: nobody → Andrea Cimitan (cimi)
importance: Undecided → High
Changed in overlay-scrollbar (Ubuntu):
status: New → Triaged
Andrea Cimitan (cimi) on 2013-01-09
Changed in overlay-scrollbar (Ubuntu):
status: Triaged → Confirmed
Andrea Cimitan (cimi) on 2013-09-20
Changed in overlay-scrollbar (Ubuntu):
assignee: Andrea Cimitan (cimi) → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers