snagga / bkitpoma

Automatically exported from code.google.com/p/bkitpoma
0 stars 0 forks source link

Singleton class has wrong implement #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
class AuthorWindow:

==================================================
private static AuthorWindow authorWindow = null;

public static AuthorWindow getInstance() {
        if (authorWindow != null)
            return authorWindow;
        else
            return new AuthorWindow();
    }

private AuthorWindow() {
        super();
        //Missing authorWindow = this;
    }
==================================================

You forgot to insert a comment line (authorWindow = this;).
I have not check all of Singleton class yet. But I found that AuthorWindow
has wrong implement of Singleton pattern. All of you should notice, and
recheck your code please. Thanks.

Original issue reported on code.google.com by rockerh...@gmail.com on 4 Sep 2009 at 4:26

GoogleCodeExporter commented 9 years ago
Just insert 
authorWindow = this;
at line 35.

Original comment by vo.mita.ov on 7 Sep 2009 at 4:28