#1827 GTK: Fix crash on widget destruction

Bug
closed-fixed
5
2016-05-24
2016-05-11
No

Avoid possible IdleWork() calls on destructed ScintillaGTK objects.

The idle callback removal clause in the ScintillaGTK destructor got broken in [code:4e5c321dda8e69104cb7b639c3107dc11dbc00f6], leading to the callback not being removed thus possibly running after the instance destruction.
Indeed, gdk_threads_add_idle() wraps g_idle_add() with a custom user data, thus making the g_source_remove_by_user_data() call in the destructor incorrect, as we give it our own user data, not GDK's wrapper one.

Fix the callback removal not to use user data matching to avoid this.


Attached are 3 possible implementations of a fix:

  • v1 transforms WorkNeeded::active to an IdlerID so the GTK platform can use it as such. No other platform seem to use WorkNeeded::active.
  • v2 removes WorkNeeded::active and adds a private member to ScintillaGTK with the same purpose. Again, no other platform seem to use WorkNeeded::active, hence the removal.
  • v3 is v2 but without the WorkNeeded::active removal.
3 Attachments

Related

Commit: [4e5c32]

Discussion

  • Neil Hodgson

    Neil Hodgson - 2016-05-12
    • status: open --> open-fixed
    • assigned_to: Neil Hodgson
     
  • Neil Hodgson

    Neil Hodgson - 2016-05-12

    The other core platform that uses a high-priority idle for styling is Cocoa. Adding styleIdleID is more similar to Cocoa and uses GTK+ types avoiding casts so this was the alternative I preferred. Removing active could potentially break other platforms but it wasn't used by Cocoa so appears fairly safe.

    Committed alternative 2 as [d88920].

     

    Related

    Commit: [d88920]

  • Neil Hodgson

    Neil Hodgson - 2016-05-24
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks