Merge lp:~rtandy/compiz/lp1232299 into lp:compiz/0.9.11

Proposed by Ryan Tandy
Status: Merged
Approved by: Brandon Schaefer
Approved revision: 3851
Merged at revision: 3859
Proposed branch: lp:~rtandy/compiz/lp1232299
Merge into: lp:compiz/0.9.11
Diff against target: 77 lines (+21/-6)
2 files modified
compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c (+12/-6)
compizconfig/libcompizconfig/src/main.c (+9/-0)
To merge this branch: bzr merge lp:~rtandy/compiz/lp1232299
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
Review via email: mp+214394@code.launchpad.net

Commit message

Fix gnome-flashback session starting Unity plugins. Change the profile back after processing settings upgrades. When changing profile, discard existing GSettings wrappers pointing to the old profile. Fixes: 1232299

Description of the change

This is my attempt to fix bug 1232299.

The scenario: you're logging into an environment other than Unity (so the profile is probably Default), and there are settings upgrades that haven't been applied yet. Easy to reproduce: install gnome-session-flashback and start a guest session with Flashback and Compiz. Packages for trusty are in ppa:rtandy/lp1232299

The settings upgrade machinery changes the profile to process upgrades. It needs to change it back afterwards.

The GSettings profile caches a wrapper for each schema. When it retrieves one by schema name, it needs to make sure that it actually does wrap the expected path, because the path includes the profile name, and exchange it for a new one if necessary.

I didn't measure the performance hit of checking the path name on each wrapper lookup. It might be better (more efficient) to clear the list and start from scratch when the profile changes.

I also don't know for sure whether freeing the wrapper is actually safe. I didn't find any places where it looked like other code was holding references to it, but that doesn't mean they don't exist.

I experienced one crash in unityshell while testing this (didn't have unity's dbgsym installed at the time, sadly) but I can't reproduce it now so I don't know whether or not my changes caused it.

This is almost certainly too risky for trusty at this time, but I'd love to see it in an SRU eventually.

To post a comment you must log in.
Revision history for this message
Ryan Tandy (rtandy) wrote :

> It might be better (more efficient) to clear the list and start from scratch when the profile changes.

Thinking about that again this morning, that almost certainly makes more sense. I've re-pushed the branch doing it that way instead. Had to move one function earlier in the file so the declaration would be visible. Apologies for the noise.

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Quickly looking at the code, it looks like this will leak some memory:
60 + char *previousProfile = strdup(cPrivate->profile);

As for the review it self, Ill have to test this out. Im not super familiar with these parts of compiz :).

Thanks for the merge proposal!

Also you need a commit message :)

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Also dont worry about pushing new changes, if you see fit. We will see its been changed and we'll re-review it :)

lp:~rtandy/compiz/lp1232299 updated
3850. By Ryan Tandy

Change profile back after processing upgrades.

3851. By Ryan Tandy

Drop saved gsettings wrappers when changing profile, to force creating new ones with the correct path.

Revision history for this message
Ryan Tandy (rtandy) wrote :

> Quickly looking at the code, it looks like this will leak some memory:
> 60 + char *previousProfile = strdup(cPrivate->profile);

Argh. Stupid mistake. Thanks for catching that.

Built, tested, re-pushed.

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c'
2--- compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c 2013-05-13 13:23:20 +0000
3+++ compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c 2014-04-07 23:24:42 +0000
4@@ -28,6 +28,12 @@
5 CCSGNOMEValueChangeData *valueChangeData;
6 };
7
8+static void
9+ccsGSettingsWrapperDestroyNotify (gpointer o)
10+{
11+ ccsGSettingsWrapperUnref ((CCSGSettingsWrapper *) o);
12+}
13+
14 void
15 ccsGSettingsSetIntegration (CCSBackend *backend, CCSIntegration *integration)
16 {
17@@ -177,6 +183,8 @@
18 const char *ccsProfile = ccsGetProfile (context);
19 char *profile = NULL;
20
21+ CCSGSettingsBackendPrivate *priv = (CCSGSettingsBackendPrivate *) ccsObjectGetPrivate (backend);
22+
23 if (!ccsProfile)
24 profile = strdup (DEFAULTPROF);
25 else
26@@ -189,7 +197,11 @@
27 }
28
29 if (g_strcmp0 (profile, currentProfile))
30+ {
31 ccsGSettingsBackendUpdateCurrentProfileName (backend, profile);
32+ g_list_free_full (priv->settingsList, ccsGSettingsWrapperDestroyNotify);
33+ priv->settingsList = NULL;
34+ }
35
36 free (profile);
37
38@@ -375,12 +387,6 @@
39 return priv;
40 }
41
42-static void
43-ccsGSettingsWrapperDestroyNotify (gpointer o)
44-{
45- ccsGSettingsWrapperUnref ((CCSGSettingsWrapper *) o);
46-}
47-
48 void
49 ccsGSettingsBackendDetachFromBackend (CCSBackend *backend)
50 {
51
52=== modified file 'compizconfig/libcompizconfig/src/main.c'
53--- compizconfig/libcompizconfig/src/main.c 2013-05-13 13:23:20 +0000
54+++ compizconfig/libcompizconfig/src/main.c 2014-04-07 23:24:42 +0000
55@@ -4910,6 +4910,8 @@
56 {
57 int i = 0;
58 const char *path = CCS_UPGRADE_PATH;
59+ CCSContextPrivate *cPrivate = GET_PRIVATE (CCSContextPrivate, context);
60+ char *previousProfile = strdup(cPrivate->profile);
61
62 for (i = 0; i < nFile; ++i)
63 {
64@@ -4926,6 +4928,13 @@
65
66 free (nameList[i]);
67 }
68+
69+ if (strcmp (cPrivate->profile, previousProfile))
70+ {
71+ ccsSetProfile (context, previousProfile);
72+ }
73+
74+ free (previousProfile);
75 }
76
77 Bool

Subscribers

People subscribed via source and target branches

to all changes: