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
=== modified file 'compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c'
--- compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c 2013-05-13 13:23:20 +0000
+++ compizconfig/gsettings/gsettings_backend_shared/ccs_gsettings_backend.c 2014-04-07 23:24:42 +0000
@@ -28,6 +28,12 @@
28 CCSGNOMEValueChangeData *valueChangeData;28 CCSGNOMEValueChangeData *valueChangeData;
29};29};
3030
31static void
32ccsGSettingsWrapperDestroyNotify (gpointer o)
33{
34 ccsGSettingsWrapperUnref ((CCSGSettingsWrapper *) o);
35}
36
31void37void
32ccsGSettingsSetIntegration (CCSBackend *backend, CCSIntegration *integration)38ccsGSettingsSetIntegration (CCSBackend *backend, CCSIntegration *integration)
33{39{
@@ -177,6 +183,8 @@
177 const char *ccsProfile = ccsGetProfile (context);183 const char *ccsProfile = ccsGetProfile (context);
178 char *profile = NULL;184 char *profile = NULL;
179185
186 CCSGSettingsBackendPrivate *priv = (CCSGSettingsBackendPrivate *) ccsObjectGetPrivate (backend);
187
180 if (!ccsProfile)188 if (!ccsProfile)
181 profile = strdup (DEFAULTPROF);189 profile = strdup (DEFAULTPROF);
182 else190 else
@@ -189,7 +197,11 @@
189 }197 }
190198
191 if (g_strcmp0 (profile, currentProfile))199 if (g_strcmp0 (profile, currentProfile))
200 {
192 ccsGSettingsBackendUpdateCurrentProfileName (backend, profile);201 ccsGSettingsBackendUpdateCurrentProfileName (backend, profile);
202 g_list_free_full (priv->settingsList, ccsGSettingsWrapperDestroyNotify);
203 priv->settingsList = NULL;
204 }
193205
194 free (profile);206 free (profile);
195207
@@ -375,12 +387,6 @@
375 return priv;387 return priv;
376}388}
377389
378static void
379ccsGSettingsWrapperDestroyNotify (gpointer o)
380{
381 ccsGSettingsWrapperUnref ((CCSGSettingsWrapper *) o);
382}
383
384void390void
385ccsGSettingsBackendDetachFromBackend (CCSBackend *backend)391ccsGSettingsBackendDetachFromBackend (CCSBackend *backend)
386{392{
387393
=== modified file 'compizconfig/libcompizconfig/src/main.c'
--- compizconfig/libcompizconfig/src/main.c 2013-05-13 13:23:20 +0000
+++ compizconfig/libcompizconfig/src/main.c 2014-04-07 23:24:42 +0000
@@ -4910,6 +4910,8 @@
4910{4910{
4911 int i = 0;4911 int i = 0;
4912 const char *path = CCS_UPGRADE_PATH;4912 const char *path = CCS_UPGRADE_PATH;
4913 CCSContextPrivate *cPrivate = GET_PRIVATE (CCSContextPrivate, context);
4914 char *previousProfile = strdup(cPrivate->profile);
49134915
4914 for (i = 0; i < nFile; ++i)4916 for (i = 0; i < nFile; ++i)
4915 {4917 {
@@ -4926,6 +4928,13 @@
49264928
4927 free (nameList[i]);4929 free (nameList[i]);
4928 }4930 }
4931
4932 if (strcmp (cPrivate->profile, previousProfile))
4933 {
4934 ccsSetProfile (context, previousProfile);
4935 }
4936
4937 free (previousProfile);
4929}4938}
49304939
4931Bool4940Bool

Subscribers

People subscribed via source and target branches

to all changes: