Skip to content

Conversation

cwendling
Copy link
Member

Fix #1630.

This contains 3 separate but fairly closely related changes (see each commit for details):

  1. Fix reference to objects by releasing them in dispose() as we ought to instead of waiting for finalize(). This is the real fix, and is the right thing to do in the GObject world: no object is supposed to hold a reference to any other object after dispose().
  2. Simplification of the icon update code, which optimizes it as well and allows for improving safety in 3 -- thanks @rbuj
  3. thanks to 2, make use of g_signal_connect_object() to improve safety of the handler by making sure all parameters are valid at signal dispatch time.

1 alone is enough of a fix, but 2 is a nice improvement of the code, and 3 makes things safer. Actually, 2+3 alone are also a fix for #1630, although not as thorough.

rbuj and others added 3 commits June 7, 2022 18:47
Instead of manually keeping tabs on the signals so we can disconnect
them before the data parameter gets destroyed, let GObject
automatically track lifetime of the data, which it can do as that data
is a GObject itself.

This does not change behavior in the normal case, but makes sure the
callback simply cannot get called with invalid/freed parameters, even
if we did screw anything up (which we used to).

This actually would have solved #1630 as well with using the target
widgets as data parameters as the signal would have been disconnected
as soon as the widget got destroyed, no matter whether we got finalized
ourselves or not.

The signal IDs were also use as guards to whether the monitor was set
up for the related files, but we can just as well use the state of the
file list ready handle which should only be NULL when we actually have
monitors set up.  Even if it wasn't the case, worse case scenario would
be removing a non-existent monitor, which is perfectly OK anyway.
@cwendling cwendling requested review from rbuj and lukefromdc June 7, 2022 17:40
@cwendling
Copy link
Member Author

For anybody who'd merge this, please do not squash the commits together, it'd make more sense to have the split as is (and they all leave the code in an acceptable state, although c81cc65 alone is not a fix.

Copy link
Contributor

@rbuj rbuj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing g_signal_handler_disconnect in the dispose method:

    if (details->src_handler_id)
    {
        g_signal_handler_disconnect (details->source, details->src_handler_id);
        details->src_handler_id = 0;
    }

    if (details->dest_handler_id)
    {
        g_signal_handler_disconnect (details->destination, details->dest_handler_id);
        details->dest_handler_id = 0;
    }

Copy link
Contributor

@rbuj rbuj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I didn't see the last commit.

Copy link
Member

@lukefromdc lukefromdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good on my end, some of these were the changes that worked before. Builds fine, runs with no new problems on a quick test-and stops the crashes. Will merge this and NOT squash as per request

@lukefromdc lukefromdc merged commit 764395e into master Jun 8, 2022
@lukefromdc lukefromdc deleted the conflict-fixes branch June 8, 2022 00:42
@lukefromdc lukefromdc restored the conflict-fixes branch June 8, 2022 00:42
@lukefromdc
Copy link
Member

lukefromdc commented Jun 8, 2022

Github just did something ugly: merged only the LAST commit on a "rebase and merge" will emergency revert and do a manual merge, so as to avoid force-pushing to master

@lukefromdc
Copy link
Member

Revert PR showed all three commits, looks like git worked and github just didn't show it all. Running git log or looking at the history on a local pull of master shows all three commits separately. Thus we are good to go here

@lukefromdc lukefromdc deleted the conflict-fixes branch June 8, 2022 00:50
@cwendling
Copy link
Member Author

@lukefromdc thanks, and yep master looks fine

@lukefromdc
Copy link
Member

Cherrypicked to 1.26 after testing on that branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(Hidpi) Crash w segfault on confirmation in file conflict dialog
3 participants