Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: chromeos_input_method.cc

Issue 2722002: Fix a bug that causes input methods not to work in Chrome. (Closed) Base URL: ssh://git@gitrw.chromium.org//cros.git
Patch Set: address comments Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos_input_method.h" 5 #include "chromeos_input_method.h"
6 6
7 #include <dbus/dbus-glib-lowlevel.h> // for dbus_g_connection_get_connection. 7 #include <dbus/dbus-glib-lowlevel.h> // for dbus_g_connection_get_connection.
8 #include <ibus.h> 8 #include <ibus.h>
9 9
10 #include <algorithm> // for std::reverse. 10 #include <algorithm> // for std::reverse.
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 } 493 }
494 494
495 ~InputMethodStatusConnection() { 495 ~InputMethodStatusConnection() {
496 if (dbus_proxy_) { 496 if (dbus_proxy_) {
497 g_signal_handlers_disconnect_by_func( 497 g_signal_handlers_disconnect_by_func(
498 dbus_proxy_.gproxy(), 498 dbus_proxy_.gproxy(),
499 reinterpret_cast<gpointer>(G_CALLBACK(DBusProxyDestroyCallback)), 499 reinterpret_cast<gpointer>(G_CALLBACK(DBusProxyDestroyCallback)),
500 this); 500 this);
501 } 501 }
502 502
503 if (dbus_connection_.get()) { 503 // We don't close |dbus_connection_| since it actually shares the same
504 // Close |dbus_connection_| since the connection is "private connection" 504 // socket file descriptor with the connection used in IBusBus. If we
505 // and we know |this| is the only instance which uses the 505 // close |dbus_connection_| here, the connection used in the IBus IM
506 // |dbus_connection_|. Otherwise, we may see an error message from dbus 506 // module (im-ibus.so) and |ibus_| will also be closed, that causes
507 // library like "The last reference on a connection was dropped without 507 // input methods to malfunction in Chrome.
508 // closing the connection." 508 //
509 DBusConnection* raw_connection = dbus_g_connection_get_connection( 509 // Note that not closing |dbus_connection_| produces DBus warnings
510 dbus_connection_->g_connection()); 510 // like below, but it's ok as warnings are not critical (See also
511 if (raw_connection) { 511 // crosbug.com/3596):
512 dbus_connection_close(raw_connection); 512 //
513 } 513 // The last reference on a connection was dropped without closing the
514 } 514 // connection.
515 515
516 if (ibus_) { 516 if (ibus_) {
517 // Destruct IBus object. 517 // Destruct IBus object.
518 g_signal_handlers_disconnect_by_func( 518 g_signal_handlers_disconnect_by_func(
519 ibus_, 519 ibus_,
520 reinterpret_cast<gpointer>( 520 reinterpret_cast<gpointer>(
521 G_CALLBACK(IBusBusDisconnectedCallback)), 521 G_CALLBACK(IBusBusDisconnectedCallback)),
522 this); 522 this);
523 g_signal_handlers_disconnect_by_func( 523 g_signal_handlers_disconnect_by_func(
524 ibus_, 524 ibus_,
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1195 InputMethodStatusConnection* connection) { 1195 InputMethodStatusConnection* connection) {
1196 g_return_val_if_fail(connection, false); 1196 g_return_val_if_fail(connection, false);
1197 const bool is_connected = connection->ConnectionIsAlive(); 1197 const bool is_connected = connection->ConnectionIsAlive();
1198 if (!is_connected) { 1198 if (!is_connected) {
1199 LOG(WARNING) << "ChromeOSInputMethodStatusConnectionIsAlive: NOT alive"; 1199 LOG(WARNING) << "ChromeOSInputMethodStatusConnectionIsAlive: NOT alive";
1200 } 1200 }
1201 return is_connected; 1201 return is_connected;
1202 } 1202 }
1203 1203
1204 } // namespace chromeos 1204 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698