Skip to content
  • Andrea Azzarone's avatar
    open-document-selector: Properly remove idle · e88b8456
    Andrea Azzarone authored
    It's not possible to use g_idle_remove_by_data when the idle was added with
    gdk_threads_add_idle_full. gdk_threads_add_idle_full uses g_idle_add_full
    internally but it creates a temporary data strucuture. The address of this
    temporary data structure should be passed to g_idle_remove_by_data. For obvious
    reasons we cannot do that, so let's use g_source_remove.
    
    Failing to remove the idle when the open document selector is disposed could
    result in a crash because the idle function (real_populate_liststore) would
    access invalid memory.
    
    Also remove populate_scheduled because it's not needed for two reasons:
    1. populate_liststore and real_populate_liststore always run in the same thread
    2. if populate_liststore is called before real_populate_liststore is run, there
       is no need to schedule two calls two real_populate_liststore.
    
    Close: https://bugs.launchpad.net/bugs/1646762
    e88b8456