Merge lp:~jeremywootten/pantheon-files/fix-1196427 into lp:~elementary-apps/pantheon-files/trunk

Proposed by Jeremy Wootten
Status: Merged
Approved by: Cody Garver
Approved revision: 1384
Merged at revision: 1386
Proposed branch: lp:~jeremywootten/pantheon-files/fix-1196427
Merge into: lp:~elementary-apps/pantheon-files/trunk
Diff against target: 33 lines (+3/-2)
2 files modified
src/marlin-bookmark.c (+2/-1)
src/marlin-bookmark.h (+1/-1)
To merge this branch: bzr merge lp:~jeremywootten/pantheon-files/fix-1196427
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+195513@code.launchpad.net

Commit message

Take own copy of file name when naming bookmark to fix bug #1196427

Description of the change

Fix possible cause of sporadic corruption of bookmark name. gof_file_get_display_name returns an unowned string so take own copy of it.

Difficult to test fully as I cannot reproduce the bug consistently - I do not get this bug after installing ubuntuone. I have not tested with vpn connections etc.

To post a comment you must log in.
Revision history for this message
Cody Garver (codygarver) wrote :

I'm gonna test this a few days. Once it's merged and in a stable release we can set the attached UbuntuOne bug as Incomplete. Does that sound right?

Revision history for this message
Cody Garver (codygarver) wrote :

Sorry, I misread your description.

I'll test this a few days to make sure nothing combusts. The attached bug status will become Fix'd upon merge.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Yes that's fine - I hope this fixes the bug - or at least does not cause
any regressions!

On 21 November 2013 01:15, Cody Garver <email address hidden> wrote:

> I'm gonna test this a few days. Once it's merged and in a stable release
> we can set the attached UbuntuOne bug as Incomplete. Does that sound right?
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1196427/+merge/195513
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1196427.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Revision history for this message
Victor Martinez (victored) wrote :

Dont forget to free bookmark->name when the bookmark is disposed

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Good point!

On 21 November 2013 23:21, Victor Martinez <email address hidden> wrote:

> Dont forget to free bookmark->name when the bookmark is disposed
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1196427/+merge/195513
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1196427.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Actually, is this correct? bookmark->name is defined as const char* - you
get a warning if try to free it. I am not really a C programmer so any
advice on what to do would be appreciated ...

On 21 November 2013 23:21, Victor Martinez <email address hidden> wrote:

> Dont forget to free bookmark->name when the bookmark is disposed
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1196427/+merge/195513
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1196427.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

1375. By Launchpad Translations on behalf of elementary-apps

Launchpad automatic translations update.

Revision history for this message
Victor Martinez (victored) wrote :

Good observation.

I'm pretty sure it was defined as "const char*" because it was an unowned string, so nobody else should free it.

Since the bookmark it taking its own copy now, the "const" should be removed from the definition. It should be just "char *name". Then free it with g_free.

See https://developer.gnome.org/glib/2.36/glib-String-Utility-Functions.html#g-strdup

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

OK, thanks for the advice!

On 25 November 2013 16:35, Victor Martinez <email address hidden> wrote:

> Good observation.
>
> I'm pretty sure it was defined as "const char*" because it was an unowned
> string, so nobody else should free it.
>
> Since the bookmark it taking its own copy now, the "const" should be
> removed from the definition. It should be just "char *name". Then free it
> with g_free.
>
> See
> https://developer.gnome.org/glib/2.36/glib-String-Utility-Functions.html#g-strdup
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1196427/+merge/195513
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1196427.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

1376. By Igor Zubkov

Fix typo in ProgressUIHandler.vala

Revision history for this message
Cody Garver (codygarver) wrote :

Jeremy, is this branch ready?

1377. By Launchpad Translations on behalf of elementary-apps

Launchpad automatic translations update.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Sorry Cody, having hardware problems at the moment. Hope to fix soon, but
if someone wants to take this over, please feel free.

On 30 November 2013 18:02, Cody Garver <email address hidden> wrote:

> Jeremy, is this branch ready?
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1196427/+merge/195513
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1196427.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

1378. By Rico Tzschichholz

Provide a custom binding to preserve backwards compatibility with a binding change to a libnotify function. Fixes bug #1252491.

1379. By Launchpad Translations on behalf of elementary-apps

Launchpad automatic translations update.

1380. By Rico Tzschichholz

build: Drop obsolete gconf-2.0 dependency

1381. By Rico Tzschichholz

build: Reference and update internal dependencies

1382. By Rico Tzschichholz

build: Reference and update internal dependencies of plugins

1383. By Jeremy Wootten

New version built on latest revision 1382 of Files. Bookmark takes own copy of name string and frees it on finalize.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

OK, just pushed a new version based on revision 1382 for testing. This
changes bookmark-> name to a char* and frees it on finalizing, as advised
by Victor.

On 30 November 2013 18:02, Cody Garver <email address hidden> wrote:

> Jeremy, is this branch ready?
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1196427/+merge/195513
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1196427.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Revision history for this message
Julián Unrrein (junrrein) wrote :

You can remove the g_message line. There is already a g_warning a couple of lines after that.

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

OK, I'll do that.

I am not sure what the warning message is for either - it doesn't seem to
be warning of any potential error situation.

On 7 December 2013 18:03, Julián Unrrein <email address hidden> wrote:

> You can remove the g_message line. There is already a g_warning a couple
> of lines after that.
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1196427/+merge/195513
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1196427.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

1384. By Jeremy Wootten

Remove unnecessary message

Revision history for this message
Jeremy Wootten (jeremywootten) wrote :

Superfluous message removed

On 7 December 2013 18:03, Julián Unrrein <email address hidden> wrote:

> You can remove the g_message line. There is already a g_warning a couple
> of lines after that.
> --
>
> https://code.launchpad.net/~jeremywootten/pantheon-files/fix-1196427/+merge/195513
> You are the owner of lp:~jeremywootten/pantheon-files/fix-1196427.
>

--
Jeremy Wootten
GPG Key ID CB585BCD
Key Fingerprint 37C0 3C2A A6D4 E45B BA7C 4328 2DF2 1882 CB58 5BCD

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/marlin-bookmark.c'
2--- src/marlin-bookmark.c 2013-09-09 03:08:16 +0000
3+++ src/marlin-bookmark.c 2013-12-08 15:54:45 +0000
4@@ -54,6 +54,7 @@
5 bookmark = MARLIN_BOOKMARK (object);
6 marlin_bookmark_disconnect_file (bookmark);
7 g_free (bookmark->label);
8+ g_free (bookmark->name);
9 //SPOTTED!
10 g_warning ("%s", G_STRFUNC);
11 g_object_unref (bookmark->file);
12@@ -304,7 +305,7 @@
13 if (bookmark->label != NULL)
14 bookmark->name = bookmark->label;
15 else
16- bookmark->name = gof_file_get_display_name (bookmark->file);
17+ bookmark->name = g_strdup (gof_file_get_display_name (bookmark->file));
18
19 g_signal_emit (bookmark, signals[CONTENTS_CHANGED], 0);
20 }
21
22=== modified file 'src/marlin-bookmark.h'
23--- src/marlin-bookmark.h 2013-09-09 03:08:16 +0000
24+++ src/marlin-bookmark.h 2013-12-08 15:54:45 +0000
25@@ -44,7 +44,7 @@
26
27 struct MarlinBookmark {
28 GObject object;
29- const char *name;
30+ char *name;
31 char *label;
32 GOFFile *file;
33 GFileMonitor *monitor;

Subscribers

People subscribed via source and target branches

to all changes: